Skip to content

Instantly share code, notes, and snippets.

@YeeJiaWei
Created February 13, 2023 14:05
Show Gist options
  • Save YeeJiaWei/f87b0032c318ff3be87c1d8bf56c97e0 to your computer and use it in GitHub Desktop.
Save YeeJiaWei/f87b0032c318ff3be87c1d8bf56c97e0 to your computer and use it in GitHub Desktop.
Script to Setting Up Octoprint on Raspbian
# Need at least Python 3.7, 3.8, 3.9 or 3.10 for basic packages
python3 --version
cd ~
sudo apt update
# Install required packages
sudo apt install python3 python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential libffi-dev libssl-dev
mkdir OctoPrint && cd OctoPrint
# Activate python environment
python3 -m venv venv
source venv/bin/activate
# Update pip and install octoprint
# --no-cache-dir can be used if old version octoprint installed before
pip install pip --upgrade
pip install octoprint
# Allow to access the serial ports
sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi
# Start the server
~/OctoPrint/venv/bin/octoprint serve
# Automatic startup
wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service && sudo mv octoprint.service /etc/systemd/system/octoprint.service
# Remember update file to correct path, if anything is changed
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment