Skip to content

Instantly share code, notes, and snippets.

@stephansomers
Last active June 12, 2024 15:37
Show Gist options
  • Save stephansomers/acd65e724973f7b5b29cc500129338c6 to your computer and use it in GitHub Desktop.
Save stephansomers/acd65e724973f7b5b29cc500129338c6 to your computer and use it in GitHub Desktop.
OctoPrint for beginners - How to install and setup!

Guide for installing and setting-up your OctoPrint!

This documentation provides step-by-step instructions to install OctoPrint on a Debian Buster system using the terminal. Please follow each step carefully.

This guide will assist you to install OctoPrint in systems other than Raspberry Pi, such as Orange Pi, Asus Tinker Board, ODROID, Banana Pi, PINE64, NanoPi, BeagleBone and much more.

What is OctoPrint and why should you use it?

TLDR: OctoPrint is free software for managing 3D printers remotely through a web browser.

  • OctoPrint is an open-source, web-based 3D printer management and control software.
  • It provides a user-friendly interface accessible through a web browser, allowing you to control and monitor your 3D printers remotely.
  • You can upload 3D models, start and pause prints, and view progress and status in real-time.
  • OctoPrint supports a wide range of 3D printers, making it compatible with various models and brands.
  • It offers a plugin system that allows you to extend its functionality and add new features to customize your printing experience.
  • It was developed with a focus on convenience and ease of use, OctoPrint has become a popular tool among 3D printing enthusiasts and professionals.

octoprint logo

Prerequisites

Hardware

  • Single Board Computer (SBC) of your choice (in this guide I will be using an Orange Pi 3 LTS)
  • Good power supply for your SBC - keep in mind the camera may draw some additional power (I have a 5V 3A power supply)
  • microSD + reader
  • Mouse and Keyboard - for first setup only
  • HDMI monitor and cable - for first setup only
  • A stable internet connection, either Wi-Fi or cable
  • Another computer to setup and access your SBC/OctoPrint
  • Optional: Webcam for monitoring and creating timelapses.

Software

  • Operating System image for your SBC - you can get at your device manufacturer website (I will use Debian Bullseye for my Orange Pi 3 LTS)
  • SD card flasher app (like balenaEtcher)
  • SSH (Secure Shell) client to access your device remotely (like Putty)
  • Optional: IP scanner to easily find and access your device (like Angry IP Scanner)

Booting and configuring the SBC

  1. Use balenaEtcher to flash the OS image onto the microSD card.

    balenaEtcher screenshot

  2. Once the process is completed, insert the microSD card into your SBC.

  3. Turn on your device and wait for it to boot.

  4. Connect and use your mouse and keyboard to connect the device to the preferred Wi-Fi network.

    On the upper right corner, you can click on the Ethernet icon to find the network.

    orange pi debian desktop

Connecting into your SBC remotely

  1. Optional: Open Angry IP Scanner and click on 'Start' to search for the IP address of your SBC.

    angry ip scanner interface

  2. Open Putty, write the IP address of the device on the Host Name or IP address field and make sure you have selected SSH as the connection type. Click Open.

    putty interface

  3. Log in with the username root and the password orangepi. Attention: this step may vary from manufacturer to manufacturer, read the SBC manual for more info.

    putty ssh interface

Alternatively, you may login via SSH to your device, run orangepi-config and connect to the desired Wi-Fi.

Creating a new user and updating the system

  1. Add a new user and set a new password for it.

    sudo adduser USERNAME
    

    🚩 USERNAME is just a placeholder, you can change it

    creating user via putty

  2. Grant Super User Do (sudo) permission

    adduser USERNAME sudo
    

    🚩 USERNAME is just a placeholder, remember to change it

    sudo via putty

  3. Check if the user has sudo permission

    id USERNAME
    

    🚩 USERNAME is just a placeholder, remember to change it

    id via putty

  4. Login on your new user

    su USERNAME
    

    🚩 USERNAME is just a placeholder, remember to change it

    login via putty

  5. Download and install overall system updates

    sudo apt update
    

    Note: This might take a while.

    update via putty

    After all packages have been downloaded, run the next command

    sudo apt upgrade
    

    update via putty

    Note: This might take a while.

  6. Download and install Python

    sudo apt install python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential
    

    installing python

  7. Optional: Download and install other dependencies for using the webcam for timelapses and monitoring.

    sudo apt-get install build-essential libjpeg9-dev imagemagick libv4l-dev cmake git -y libjpeg-dev
    

    other dependencies via putty

    After all packages have been downloaded, run the next command

    sudo apt install cmake
    

    cmake via putty

Installing OctoPrint (finally!)

  1. Go to your home directory (folder)

    cd ~
    

    cd ~

  2. Create a new directory and enter it

    mkdir OctoPrint && cd OctoPrint
    

    creating new directory

  3. Configure a Python virtual environment

    python3 -m venv venv
    source venv/bin/activate
    

    You should see the (venv) on your terminal now if everything goes OK.

    python venv

  4. Install Python PIP (Preferred Installer Program)

    sudo apt install python-pip
    

    python pip

  5. Install Python setuptools and wheel

    sudo pip3 install --upgrade pip setuptools wheel
    

    python setuptools and wheel

  6. Install OctoPrint

    pip install --no-cache-dir octoprint
    

    Note: the '--no-cache-dir' ensures you are installing the latest version of OctoPrint. Also, this might take a while.

    octoprint

  7. Grant access to the serial ports for your user

    sudo usermod -a -G tty USERNAME
    

    USERNAME is just a placeholder, remember to change it

    And then

    sudo usermod -a -G dialout USERNAME
    

    🚩 USERNAME is just a placeholder, remember to change it

    serial permission

  8. Go inside the /OctoPrint/venv/bin/ folder and start the octoprint service

    You may use ls -la to list the folder and files and cd FOLDERNAME to access it.

    browsing folders

    And run the command to start it.

    octoprint serve
    

    starting octoprint service

  9. Configure the automatic start of the OctoPrint service (so that every time you boot your SBC, OctoPrint will turn on as well)

    Run one command after the other has finished.

    wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service
    
    sudo mv octoprint.service /etc/systemd/system/octoprint.service
    
    ExecStart=/home/USERNAME/OctoPrint/venv/bin/octoprint
    

    🚩 USERNAME is just a placeholder, remember to change it

    sudo systemctl enable octoprint.service
    

    autostart

    To confirm everything worked correctly, you may go to /etc/systemd/system/ directory and search for the octoprint.service.

    octoprint service

  10. Now open a web browser on your computer and type the IP address of your SBC and add :5000 to the end of it (example http://192.168.5.8:5000/)

octoprint ui

After going thru all the steps on OctoPrint's UI, making sure you configure it correctly with the print bed size and maximum height and nozzle diameter, you will see a screen similar to this.

image

Optional: Installing MJPG-Streamer for timelapses and monitoring

  1. Make sure you are inside your /home directory of the user you created - it should contain the OctoPrint folder as well. (Remember to use the cd and ls -la commands to go into folders and list their contents.

    Use pwd to check the current directory you are located.

    pwd + ls -la

  2. Create a new directory and enter it

    mkdir ~/mjpg-streamer && cd ~/mjpg-streamer
    

    mjpg streamer directory

  3. Install mjpg-streamer using the following command

    git clone https://github.com/jacksonliam/mjpg-streamer.git
    

    installing mjpg

  4. Enter the folder that has been created

    cd mjpg-streamer/mjpg-streamer-experimental
    
  5. Install / compile the files

    make
    sudo make install
    

    make mjpg

  6. Connect your webcam to the SBC and check if it has been detected.

    lsusb
    

    lsusb

  7. Install V4L2 utilities

    sudo apt-get install v4l-utils
    

    v4l2

  8. Reboot the system

    shutdown -r now
    

    shutdown

  9. Wait for the system to boot, enter with your user and password, then navigate inside the mjpg-streamer folders until you can see something similar to this.

    mjpg-streamer folder

  10. Type the following command line and wait for the webcam to initialize.

    Note: remember to change the /dev/video1 to your USB webcam number (also remember that the Device 002 would be video1 - always 1 number below).

sudo ./mjpg_streamer -i "input_uvc.so -n -r 1920x1080 -f 5 -q 100 -d /dev/video1" -o "output_http.so -w ./www"

start webcam

  1. Now open a web browser on your computer and type the IP address of your SBC and add :8080/?action=stream to the end of it (example http://192.168.5.8::8080/?action=stream)

image

  1. Lastly, go to the OctoPrint tab on your browser and look for the 'Classic Webcam' setting under 'Plugins'.

Make sure to configure the Stream URL as per above mentioned IP address (example http://192.168.5.8::8080/?action=stream) and test it.

octoprint webcam

On the Snapshot URL use the following http://127.0.0.1:8080/?action=snapshot and click on Test. You should see an image captured by the webcam.

octoprint webcam

Done! You have fully configured your Single Board Computer and OctoPrint! Happy Printing!

Plugin Recommendations

They may be installed via the Plugin Manager on OctoPrint, the links below are for your reference only and to get more information about those plugins.

Thank you for reading this, any feedback is welcome!

Let me know if you have any doubts or comments :)

If you are feeling generous, you may buy me a coffee ☕ (soon).

@Samson666
Copy link

sudo pip3 install --upgrade pip setuptools wheel won't work. Without the 'sudo' it works perfect.

@dbesoli
Copy link

dbesoli commented Jun 12, 2024

I'd the same issue but I think it's because the pip3 isn't installed at system level.
I did
sudo apt install python3-pip
apt install libffi-dev
outside the venv and then the rest of the process worked find

the libffi-dev is a dependency required by octoprint build that isn't on the latest versions of armbian for bananapi. Not sure if with other versions is yet installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment