Installing CUPS on PVE’s LXC Container System
| Introduction: |
At home, I use a
Canon LBP6030USB printer connected to a Padavan system on a router (Youku1) to enable wireless printing. However, wireless printing can only be achieved on the Windows platform, and on systems such as macOS and IOS from Apple, it cannot be achieved, causing some inconvenience.I came across this post on
SMZDMN1刷armbian變身打印服務器, which can installCUPSsoftware as a printer server system, and thus the following content was recorded.
| Table of Contents: |
- Requirements
- Installation of LXC container system (Debian) on PVE
- Passing through USB ports to LXC
- Installation of CUPS software and printer driver on LXC (Debian)
- Installation and printing test on multiple platform systems
| Requirements: |
Platform that can install
CUPSsoftwareSuch as armbian, ubuntu, centos, etc. I chose the Debian Linux platform.
Printer driver that supports the platform
If the driver that supports the platform can be found on OpenPrinting, this step can be ignored.
| Installation of LXC container system (Debian) on PVE |
LXCprovides an operating system-level virtualization environment that is installed on a system based onLinux.The free
PVEvirtual server makes it easy to create a newLinuxsystem (i.e., a canned system) with a shared kernel.
Download the CT template:


Create the LXC system:









The newly created LXC system does not need to be started yet.
| Passing through USB ports to LXC: |
Connect the USB port of the printer
Canon LBP6030to the USB port of thePVEhost.

Use lsusb to check the connected USB devices:
| |
We can see that Device 003 on Bus 001 is Canon.

Check thedevice number of Canon on the Bus 001:
| |
Allow LXC to access the USB device on PVE through
cgroup.
| |
The
IDofLXCis100, and the configuration file path is/etc/pve/lxc/100.conf.The device inside
189:* rwmis allowed to be read, written, and mounted.Mount the entire
Bus 001USB port. The advantage of this is that even if the device number changes due to unplugging the USB port of the printer multiple times, the mounting will not be affected.

Start the newly created LXC container.

Check if it has been mounted in the LXC container’s Console:
| |
Seeing
Manufacturer: Canon, Inc.means that the USB printer has successfully connected to theLXCcontainer.
| Installation of CUPS software and printer driver on LXC (Debian) |
CUPS(Common UNIX Printing System) is a printing system supported in Fedora Core3 that mainly usesIPP(Internet Printing Protocol) to manage print jobs and queues, but also supports communication protocols such asLPD(Line Printer Daemon),SMB(Server Message Block), andAppSocket. From Baidu
Install the CUPS software:
| |
Enable remote access to CUPS:
| |
Add the current user to the lpadmin group:
| |
If the printer that is supported can be found on OpenPrinting, this step can be ignored.
Download and install the printer driver for Canon LBP6030:
| |
Enter the following address in a browser: https://10.1.1.253:631/admin/
The IP address of the
LXCsystem is:10.1.1.253








Print test page:

Installing
CUPSsoftware completes the configuration of the printer server system.
| Installation and testing of printer on multiple platforms |
After the deployment of
CUPSsoftware, multiple platforms can share printers. In the following example, I tested wireless printing functionality onWindows7,Windows10,macOS,iOS, andAndroid.
| Installing Printer on Windows 10: |
Installing Printer through Search

Manual Installation of Printer
If the printer cannot be found through search or on a different network segment, manual installation of the printer is required.
Open the CUPS interface by entering http://10.1.1.253:631 in a browser and copy the path.
Paste the path # Note that it cannot be https.

| Installing Printer on Windows 7: |
Manually install the printer and prepare the corresponding Windows driver in advance.
Note that the pasted path cannot be https.
Select the Windows driver that was prepared in advance.

| Installing Printer on macOS: |

| Installing Printer on Android: |
The tested Android device is the OnePlus 6, and the “Mopria Print Service” app is installed from the software store.
| Installing Printer on Linux (Deepin): |





| Conclusion: |
I believe that the most difficult part is the installation of the printer driver. If the manufacturer and model are found on OpenPrinting, the process should be relatively simple.
The advantage of using PVE’s LXCcontainer with CUPS installed is that it makes managing printers on a network much easier, especially for multiple users and devices. Overall, the installation process for printers on different operating systems varies, but with the right steps and information, it can be accomplished successfully.
Manually install printers using software like
zero-tier, which can enable remote (cross-regional) printing. For example, you can directly access your home printer from work to print documents.
| References: |
