Home » How to install and configure printers on Linux (cups and foomatic-db)?

How to install and configure printers on Linux (cups and foomatic-db)?

by blackMORE

This is a small guide on How to install configure printers on Linux (cups and foomatic-db)?.We will be using cups, cups-client and foomatic-db for this purpose. Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. How to install and configure printers on Linux (cups and foomatic-db) - blackMORE OpsIt supports CUPS, LPRng, LPD, GNUlpr, Solaris LP, PPR, PDQ, CPS, and direct printing with every free software printer driver known to us and every printer known to work with these drivers. If you’re not familiar with read it from the Linux Foundation

How to install configure printers on Linux

Following hardware’s are proven to be working with cups and foomatic-db.

Supported Hardware’s:

  1. Local Printers:
    1. HP Printer (HPLIP)—– All HP series
    2. Canon MP270 series (Canon MP270 series) — All Canon series
    3. HP Fax (HPLIP)
  2. Network Printers:
    1. Internet Printing Protocol (http)
    2. Internet Printing Protocol (ipps)
    3. Internet Printing Protocol (ipp)
    4. AppSocket/HP JetDirect
    5. Internet Printing Protocol (https)
    6. LPD/LPR Host or Printer
    7. Windows Printer via SAMBA

Install required packages

In here we install required packages and their dependencies using apt-get or aptitude

 apt-get install cups cups-client "foomatic-db"

How to install and configure printers on Linux (cups and foomatic-db) - install cups and foomatic-db - blackMORE Ops

Add user to lpadmin group

Now we add root or any other user to lpadmin group. lpadmin group owns printing preferences.

 adduser root lpadmin

Output

 Adding user `root' to group `lpadmin' ...
 Adding user root to group lpadmin
 Done.

How to install and configure printers on Linux (cups and foomatic-db) - adduser - blackMORE Ops

root mean your system account, if your account is with different name, type different name. For example, If your username is userX do this:

adduser userX lpadmin

Output

 Adding user `userX' to group `lpadmin' ...
 Adding user userX to group lpadmin
 Done.

Restart cups and samba service

Now wer restart cups service just to make sure everything is ok.

  service cups restart

If you also have SAMBA service running, restart that:

service samba restart

Start cups service

If you haven’t started or restarted cups already, this is the time to do it.

 service cups start

Output

 [ ok ] Starting Common Unix Printing System: cupsd.

How to install and configure printers on Linux (cups and foomatic-db) - cups and samba restart - blackMORE Ops

Find USB printer

To find USB printer type the following in Terminal

 netstat -ant | grep 631

Output

 tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
 tcp6 0 0 ::1:631 :::* LISTEN
 tcp6 0 0 ::1:39723 ::1:631 ESTABLISHED
 tcp6 0 0 ::1:39722 ::1:631 ESTABLISHED
 tcp6 0 0 ::1:631 ::1:39723 ESTABLISHED
 tcp6 0 0 ::1:39721 ::1:631 ESTABLISHED
 tcp6 0 0 ::1:631 ::1:39721 ESTABLISHED
 tcp6 0 0 ::1:39720 ::1:631 ESTABLISHED
 tcp6 0 0 ::1:39724 ::1:631 TIME_WAIT
 tcp6 0 0 ::1:631 ::1:39722 ESTABLISHED
 tcp6 0 0 ::1:631 ::1:39720 ESTABLISHED

In terminal type:

 lsusb

Output

 Bus 001 Device 010: ID 04a9:173b Canon, Inc.

(Output depends on your printer series)

Configuring Printer

  1. Open browser and type:
    http://127.0.0.1:631/
  2. In semicolon: CUPS for Administrators
  3. Click on Adding Printers and Classes
  4. Click on Add printer
  5. Type your username(system account) and password(system password)
  6. Choose your printer
  7. Follow instructions to complete rest of the installation……
  8. In System Settings: Go and check
    • Printers
  9. You’ll see your installed printer

Add cups service to startup

Follow steps below to add cups for printer to start-up programs:

  1. Go to System Tools>Preferences>Start-up Programs
  2. Click on Add
  3. Type:
    Name: Cups & printers
    command :

    service cups start

    comment: CUPS-standards-based, open source printing system

Now you can print from Linux.

You may also like

16 comments

saif June 25, 2014 - 4:01 pm

Hi, I tried you method but as soon as I reached the “Find USB printer” step this was the output –

tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN

I went ahead and did the next step $ lsusb and the output was this –

Bus 004 Device 010: ID 03f0:042a Hewlett-Packard
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 8087:07da Intel Corp.
Bus 003 Device 003: ID 0489:d600 Foxconn / Hon Hai
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

After that when i went on the link – http://127.0.0.1:631/ in Iceweasel, it simply says unable to connect.

Please let me know what went wrong here.

Thank you

Reply
blackMORE Ops June 26, 2014 - 5:36 pm

Hi saif,
Have you checked the following things??
1. Check your browser network settings.
2. Check whether CUPS is running : netstat -tapln | grep cups
3. Check CUPS log and syslog
Also try reinstalling cups server.
To restart cups server:

/etc/init.d/cups restart

To reinstall cups server:

aptitude reinstall cups

Also ensure this got nothing to do with your HOSTS file. Check these references:
http://ubuntuforums.org/archive/index.php/t-1409724.html
http://forums.debian.net/viewtopic.php?f=10&t=62374
https://bbs.archlinux.org/viewtopic.php?id=23430
Let us know how it went. Good Luck.
-BMO

Reply
daniel miring'u (@mirish2) November 29, 2018 - 12:47 pm

hi,this command (aptitude reinstall cups)deleted all my kali packages
For now i can’t sudo,apt-get,su everywhere am getting ‘ command not found’. when i use su i get ‘ Authentication failure’

Reply
daniel miring'u (@mirish2) November 29, 2018 - 1:22 pm

i managed to reset root password but can’t get to repository for updates. Am getting this
root@geek:/home/geek# leafpad /etc/apt/sources.list
No protocol specified
leafpad: Cannot open display:

Any HELP pls?

Reply
Ravinder kumar March 20, 2015 - 2:53 am

after typing the first command i have the following output:

Reading package lists… Done
Building dependency tree
Reading state information… Done
Package cups is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘cups’ has no installation candidate
E: Unable to locate package foomatic-db

Reply
medic233 March 20, 2015 - 8:32 pm

Then your sources are not configured correctly. Add them to /etc/sources.list

Reply
medic233 March 20, 2015 - 8:35 pm

Search for “20 things to do after installing Kali” which should lead you to another blackmoreops page.

Bah, edit /etc/apt/sources.list

Too early in the morning and not enough coffee inside of me yet.

Reply
Antony April 22, 2016 - 4:58 pm

I have this error
Failed to restart samba.service: Unit samba.service is masked.

please help me sort it out

Reply
chiajw1 December 27, 2016 - 2:04 pm

Ravinder kumar:
Do you run apt-get update first?

Antony:
Try “service smbd restart”

Reply
sid June 27, 2017 - 5:00 am

apt-get install cups cups-client “foomatic-db”
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package cups is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
cups-client

E: Package ‘cups’ has no installation candidate
E: Unable to locate package foomatic-db

this is the error which i get..what should i do now

Reply
wokezombie November 5, 2018 - 8:10 am

This is great, i couldn’t get it to work, I finally got my printer added, think I should be able to actually print something now, thanks so much!

Reply
joe February 8, 2019 - 12:33 am

service cups start
Job for cups.socket failed.
See “systemctl status cups.socket” and “journalctl -xe” for details.

service cups start
Job for cups.socket failed.
See “systemctl status cups.socket” and “journalctl -xe” for details.

how do you fix this

Reply
Sumit July 3, 2019 - 6:05 am

Thankyou bro, it worked for me Canon MP270 …

Reply
Laxmi yantra October 25, 2019 - 7:46 pm

Buy Astrology, Vastu and Feng shui products online at best price and best quality. Siddh Asht Lakshmi Shri Yantra framed Lakshmi yantra completely siddh buy online at best price and best quality. Sampoorna Maha Lakshmi Yantra buys framed yantra from devotionalkart COD and prepaid option available.

Reply
Gmail bellen December 2, 2022 - 5:52 pm

Actually, this information is very useful, because I learned a lot from this. it helped me a lot. I hope to have many more entries or so from you.

Reply
Facebook bellen December 3, 2022 - 6:44 pm

Wow! works for me. Thanks

Reply

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.