Install OctoPrint - 3D Printer Web UI - on Linux 🌱

What is OctoPrint?

OctoPrint provides a snappy web interface for controlling consumer 3D printers. -https://github.com/OctoPrint/OctoPrint

Installation

  1. Log into the Linux device
  2. Run the following commands in terminal
    # update software repositories
    sudo apt update
    # install available software updates
    sudo apt upgrade -y
    # install prerequisites
    sudo apt install python3 python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential libffi-dev libssl-dev -y
    # create an octoprint directory
    sudo mkdir /opt/OctoPrint
    # set ownership of the directory
    sudo chown $USER:$USER /opt/OctoPrint
    # change directory
    cd /opt/OctoPrint
    # create a python virtual environment
    python3 -m venv venv
    # activate the virtual environment
    source venv/bin/activate
    # install wheel
    pip install --upgrade pip wheel
    # install octoprint
    pip install octoprint
    # test octoprint installation
    /opt/OctoPrint/venv/bin/octoprint serve
  3. Open a web browser and navigate to http://DNSorIP:5000
  4. Click Next on the Start screen
  5. Click Next on the Restore Backup screen
  6. Create an account my entering a Username and entering and confirming a password > Click Create Account
  7. Once the account is created, click Next
  8. Choose to Enable or Disable the Connectivity Check > Click Next
  9. Choose to Enable or Disable Anonymous Usage Tracking > Click Next
  10. Choose to Enable or Disable the Plugin Blacklist > Click Next
  11. Click Next on the Webcam Wizard screen
  12. Click Next on the Default Printer Profile screen
  13. Click Next on the Server Commands screen
  14. Acknowledge all the messages on the Finish screen > Click Finish
  15. Welcome to OctoPrint

Run OctoPrint as a Service (optional, but recommended)

  1. Back in the Terminal, press CTRL+C to kill the running OctoPrint process
  2. Continue with the following commands in terminal
    # create octoprint service file
    sudo nano /etc/systemd/system/octoprint.service
  3. Paste the following into octoprint.service

    [Unit]
    Description=The snappy web interface for your 3D printer
    After=network-online.target
    Wants=network-online.target

    [Service]
    Environment="LC_ALL=C.UTF-8"
    Environment="LANG=C.UTF-8"
    Type=exec
    User=<% replace with your username %>
    ExecStart=/opt/OctoPrint/venv/bin/octoprint serve

    [Install]
    WantedBy=multi-user.target

  4. Press CTRL+O, Enter, CTRL+X to write the changes
  5. Continue with the following commands
    # reload systemd services
    sudo systemctl daemon-reload
    # start the octoprint service on boot and now
    sudo systemctl enable octoprint --now
  6. Back in the web browser, refresh the OctoPrint tab

Source: https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspberry-pi-os-debian/2337