DEV Community

Robertopaolo Ramirez
Robertopaolo Ramirez

Posted on

How to use printer on Linux

Hello everyone,

For those who think that using a printer is difficult on Linux, here is a little guide on how to install, configure and use any printer on any Linux distribution.

ps. Sorry if my english is not so good... I'm just learning.

Step 1: Download cups

Open your terminal and type:

sudo pacman -S cups
Enter fullscreen mode Exit fullscreen mode

You can use pacman or apt-get or other package manager

Step 2: Start CUPS

sudo systemctl start cups
Enter fullscreen mode Exit fullscreen mode

Step 3: Enable CUPS

sudo systemctl enable cups
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure CUPS

sudo nvim /etc/cups/cupsd.conf
Enter fullscreen mode Exit fullscreen mode

Scroll down and find "Show shared printers on the local network" section. Here, you will find an entry title, "Browsing Off". Change this "Browsing On"

# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
Enter fullscreen mode Exit fullscreen mode

Next, find the "Only listen for connections from the local machine" section and change.

# Only listen for connections from the local machine.
Port 631
Listen /run/cups/cups.sock
Enter fullscreen mode Exit fullscreen mode

Now, find the "Restrict access to the server" section and add "Allow @LOCAL".

# Restrict access to the server...
<Location />
    Order allow,deny
    Allow @LOCAL
</Location>
Enter fullscreen mode Exit fullscreen mode

And, find the "Restrict access to the admin pages" section. If you want to modify here.

# Restrict access to the admin pages...
<Location /admin>
    AuthType Default
    Require valid-user
    Order allow,deny
    Allow @LOCAL
</Location>
Enter fullscreen mode Exit fullscreen mode

Finally, save and exit.

Step 5: Restart CUPS

sudo systemctl restart cups
Enter fullscreen mode Exit fullscreen mode

Step 6: Add your printer in CUPS

Open your browser and type: localhost:631

localhost631

In the page, click in Administration.

administration

A login screen will appear.

login

The username is: root and password is the same that you use in your root.

Inside Administration, click in Find New Printers, then we will find printers that are within CUPS range, but if we want, we can do it manually clicking in Add Printer

administration inside

Step 7: Verify Succesful Setup of CUPS Print Server

Now, we will verify if the printer that we add is ready to use.

Step 8: Open Printer

Open your linux distribution.

In my case, I use gnome as a desktop environment, so I will find in settings.

settings

Click in add.

add printer

And finally, add our printer.
I hope I was helpfull. I tried to be as brief as possible, but if you want to go deeper about CUPS, I leave the links below.

FONTS

https://wiki.archlinux.org/title/CUPS
https://www.cups.org/
https://ubuntu.com/server/docs/service-cups
https://linuxhint.com/cups_print_server_ubuntu/

Top comments (0)