Create VM
Create a new Ubuntu VM in Proxmox and write down the ID.
USB Passthough
Connect the print to the server and find the device ID in Proxmox.
lsusb
For example the following output has 1a86:7523 as the ID.
Bus 002 Device 005: ID 1a86:7523 QinHeng Electronics CH340 serial converter
Assign the ID to the VM you just created.
qm set 101 -usb0 host=1a86:7523
Install OctoPrint

Update the VM and install the dependencies.
sudo apt update
sudo apt install python3 python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential libffi-dev libssl-dev
Create a python virtual environment in a new folder.
mkdir octoprint && cd octoprint
python3 -m venv venv
source venv/bin/activate
With the virtual environment active, upgrade and install the following packages.
pip install --upgrade pip wheel
pip install octoprint
Finally, add your user to the tty and dialout groups.
sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi
Now, it might be necessary to logout for the changes to take effect. After that, go back into the virtual environment and start OctoPrint.
octoprint serve
Start after reboot
Create a new file /etc/systemd/system/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=user
ExecStart=/home/user/octoprint/venv/bin/octoprint serve
[Install]
WantedBy=multi-user.target
Now, enable the service using systemctl.
sudo systemctl enable octoprint.service
Note: You may need to reload the daemon after changes.
sudo systemctl daemon-reload
