A big part of the post is reusing info from a post on the OctoPrint forum
https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspberry-pi-os-debian/2337: Controlling your 3D Printer with ProxmoxThat being said it was not written to be installing on Ubuntu or in a VM so there are some more steps that we are going to need to take.
For this post I am going to assume that you know how to setup a vm and how to pass a usb port to a vm in Proxmox if you do not it will be covered in the video at the bottom.
Now that you have your VM of Ubuntu 22.04 running and your USB port for your printer passed to that VM it is time to start installing OctoPrint. The first thing that we you need to do is to update and upgrade your install of Ubuntu.
sudo apt update && sudo apt upgrade -y
now that you have your update done it is time to setup a new user OctoPrint is ment to be used with a user pi but Ubuntu dose not have this user by default like a Raspberry Pi would so we will need to set this up.
sudo adduser pi
now we need to give the user sudo rights
sudo adduser pi sudo
The last step for user config is to give the user the rights to use serial
sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi
exit
Now log back in with the pi user
now lets go to root
cd ~
and install dependencies for OctoPrint
sudo apt install python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential -y
make an folder for OctoPrint and move to the folder.
mkdir OctoPrint && cd OctoPrint
setup a virtual environment for python
python3 -m venv venv
Activate the environment
source venv/bin/activate
Now lets install OctoPrint
pip install pip --upgrade
pip install octoprint
Time to test the web interface
~/OctoPrint/venv/bin/octoprint serve
Go to a web browser and navigate to http://<your IP>:5000
the last step is to set up auto start up. To do this we are going to download this script and move it to systemd/system
wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service && sudo mv octoprint.service /etc/systemd/system/octoprint.service
Adjust the path if needed if you fallowed this post your /etc/systemd/system/octoprint.service
shoud look like this
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint
now start you service
sudo service octoprint start