Created
August 31, 2025 10:55
-
-
Save htoik/8b0ce66c4cf21396a6a9f63b3e539d4c to your computer and use it in GitHub Desktop.
Install OctoPrint on Ubuntu 24.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| sudo apt update && sudo apt upgrade -y | |
| sudo apt install -y python3 python3-venv python3-pip python3-dev git libffi-dev libusb-dev libyaml-dev build-essential | |
| # Create user for octoprint and switch to it | |
| sudo useradd -m octoprint | |
| sudo passwd octoprint | |
| sudo usermod -aG dialout octoprint | |
| sudo chsh -s /bin/bash octoprint | |
| sudo su - octoprint | |
| # Install OctoPrint in a venv | |
| python3 -m venv ~/OctoPrint-venv | |
| source ~/OctoPrint-venv/bin/activate | |
| pip install pip --upgrade | |
| pip install octoprint | |
| # Run OctoPrint | |
| octoprint serve | |
| # Run on boot | |
| sudo tee /etc/systemd/system/octoprint.service > /dev/null << 'EOF' | |
| [Unit] | |
| Description=OctoPrint | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| User=octoprint | |
| ExecStart=/home/octoprint/OctoPrint-venv/bin/octoprint serve | |
| Restart=on-failure | |
| Nice=-2 | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| sudo systemctl daemon-reload | |
| sudo systemctl enable octoprint | |
| sudo systemctl start octoprint | |
| # Check status | |
| systemctl status octoprint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment