PC: ASUS Eee PC 701

2GB RAM

CPU: i686

OS: Debian 9

I am writing this post to remind myself how hard it was setting up a linux server for OctoPrint. These steps will help me repeat the procedure in case I need to start from ground zero.

Setting up the OS

Install OS

Configure disk (use fdisk to delete partitions if the installer cannot find disk drive or partitions)

Manual Partitioning using an SD Card

-use /dev/sda as root

-use /dev/sdc (sd card) for /home /tmp /var swap, etc…

No need to install GUI, just SSH server

Configure users (add user to dialout and tty group as well as uucp and plugdev)

Add Repos inluding Debian backports – https://backports.debian.org/Instructions/ (this helped Octoprint detect the serial port)

switch to superuser

su

nano /etc/apt/sources.list

comment out cd rom in sources.list

nano /etc/apt/sources.list.d/backport.list

add this line to the sources.list

deb http://deb.debian.org/debian bullseye-backports main

apt update

apt upgrade

install packages

apt install sudo htop tmux wget curl ffmpeg zlib1g zlib1g-dev libssl-dev cmake libjpeg62-turbo-dev locate

install python

wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz

tar xJf Python-3.6.3.tar.xz

I was facing issues with installing Python. I dscovered that I needed to uncomment some SSL lines to get Python to install properly. (reference https://stackoverflow.com/questions/46283099/pip-install-issue-with-the-ssl-certificate?rq=1)

sudo nano Python-3.6.3/Modules/Setup.dist

cd Python-3.6.3/

./configure (try enable optimizations)

make

make install

mkdir OctoPrint && cd OctoPrint

python3.6 -m venv venv

source venv./bin/activate

pip install --no-cache-dir octoprint

Setup Octoprint as a service

Grab the script from Octoprint’s github page

wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service && sudo mv octoprint.service /etc/systemd/system/octoprint.service

sudo nano /etc/systemd/system/octoprint.service

In the octoprint.service file, edit user to your user and edit ExecStart path to include your user directory

sudo systemctl daemon-reload

sudo systemctl enable octoprint.service

sudo sevice octoprint start

Now OctoPrint service should be enabled and start at boot

Use the command below to check the status

sudo systemctl status octoprint.service

Here is the reference to install OctoPrint using developer documentation (python) – https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian-or-raspberry-pi-os/2337

Webcam Setup

First, we need to install MJPG-Streamer

mkdir ~/mjpg-streamer

cd ~/mjpg-streamer

Grab the code from GitHub and compile

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

cd mjpg-streamer/mjpg-streamer-experimental

make

sudo make install

/usr/local/bin/mjpg_streamer -i "input_uvc.so -f 15 -r 640x480" \ -o "output_http.so -w /usr/local/share/mjpg-streamer/www"

use -p for port

To start mjpg-streamer at startup follow the guide linked below

https://krystof.io/mjpg-streamer-on-a-raspberry-pi-zero-w-with-a-usb-webcam-streaming-setup/

sudo apt install libjpeg62-turbo-dev

usr/local/bin/mjpg_streamer -i "input_uvc.so -f 15 -r 1920x1080" \ -o "output_http.so"

Setup the Laptop Lid to Close Without Affecting Connectivity

To make sure that closing the lid does not affect the server from sleeping, you need to edit the systemd file

sudo nano systemctl restart systemd-logind.service

uncomment HandleLidSwitch and instead of suspend type ignore

Connect to OctoPrint

Navigate to your server IP:5001 and enjoy OctoPrint!