Debian add printer: command line, install cups, by IP

Debian add printer: command line, install cups, by IP

This article will show you how to install a printer on Debian, avoiding common problems and ensuring a smooth and straightforward operation.

How to install printer on Linux?

Before you start the install procedure, follow these simple steps to avoid hassle and trouble-shooting later on:

  1. Connect your printer: Ensure that your printer is connected to your computer and turned on.
  2. Check printer compatibility: Make sure that your printer model is supported by Debian. Visit the Debian wiki or the printer manufacturer's website to find out if there are any specific instructions or drivers available.
  3. Update your system: It's always a good idea to start by updating your Debian system to ensure you have the latest software and drivers. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade

Run CUPS (Common Unix Printing System)

Open a terminal (as root) and run the following command:

aptitude update
aptitude install skanlite cups cups-client cups-filters system-config-printer
  • -cups is the printing system usually used on Unix. -You can use apt-get instead of aptitude if you prefer. If you are running KDE, you should also install:
aptitude install skanlite system-config-printer
  • -The skanlite package can be replaced with another scanning tool such as xsane (skanlite is scanning tool for KDE). - The system-config-printer package is also specific to KDE (it enriches the features of the Control Panel and displays an applet near the clock).

If you are using an HP printer, install the following:

aptitude install hplip printer-driver-hpijs 

Add a user to the lpadmin group

Add your user to the Ipadmin group, to allow the necessary privledges to manage printers. To do this, enter the following: 

sudo usermod -aG lpadmin <your_username>

Launch CUPS

We will now launch the printing system (cups). Note that cups will start automatically thereafter.

As root, run the following command:

service cups start

Troubleshoot possible errors with CUPS: (specific to systemd)

If you get any error codes at this stage, try the following:

To restart cups:

cups stop service
cups service start

-

Failed to start cups.service: Unit cups-browsed.service is masked

Unmask the service via the command:

service unmask cups.service

Check that the CUPS web interface is working

Open your favorite web browser (Firefox, Chrome, etc ...) and go to:

From the cups web interface you may automatically find the printer (Administration> Find a new printer). Now follow the on-screen instructions, chosing the correct make and model of your printer. 

Installing the printer 

Type the following command

system-config-printer &

In the "Printer Setup" window that appears click Add > Printer. Enter your password when required. Once your printer is configured, try to print the test page to see if the latter is working properly. A test page the way you can print to check that all is well. To display an applet for the Print Manager next to the clock, run this command:

system-config-printer-applet &

Configuring the scanner

Simply launch your favorite scanning tool (skanlite, xsane, etc ...) and select your device.

Need more help with Linux? Check out our Forum!
Around the same subject

Linux