Setting Up Octoprint on Linux

I followed this excellent guide from 3D Printscape for setting up Octoprint on a linux system: https://3dprintscape.com/install-octoprint-on-linux/

For a backup in case that resource disappears I’ve save a copy of that page in PDF format:

Setting server commands in Octoprint

These are the octoprint server commands I use:
Restart octoprint: sudo systemctl restart octoprint
Reboot: sudo reboot
Shutdown: sudo shutdown now

Server command permissions

You’ll probably need to grant your octoprint user the proper permissions to execute the system commands. You can do this by adding a sudoers file that grants specific permissions, here’s how:

  1. Create a /etc/sudoers.local file, this lets octoprint run certain sudo commands without needing to enter the password. I figured this out by checking the octoprint log file when server commands didn’t work.

sudo nano /etc/sudoers.local

  1. Add this content, note that “octo” is my linux user account, yours might be “pi” if following the guides

octo ALL = NOPASSWD: /sbin/reboot, /sbin/shutdown, /bin/systemctl

  1. Save the file using Ctrl+X

  2. Add an include for the new local sudoers file to the existing /etc/sudoers, first open the file for editing

sudo nano /etc/sudoers.local

  1. Add this content to the bottom of the file

@include /etc/sudoers.local

  1. Save the file using Ctrl+X

Adding custom commands for controlling your camera

System Command Editor
https://plugins.octoprint.org/plugins/systemcommandeditor/
Name: Start webcam
Action: Start-webcam
Command: sudo systemctl start webcamd