Printing in Linux can be a confusing territory. Many distributions don’t come with printing enabled by default, leaving it up to the user to set it up. This article will show you how to set up a standard USB printer in Linux.
CUPS
The Common Unix Printer Service (CUPS), which was in fact developed by Apple, is the printer server that allows one to print in Linux. It can be used with a single, local computer or with a networked group of computers. CUPS offers a web-based configuration management tool for printers.
If your distribution doesn’t have CUPS installed, use the appropriate command for your package manager to install it. For instance, if you are running Ubuntu, the command would be:
sudo apt-get install cups
Installing CUPS will place an executable binary in the directory “/etc/init.d”, which is for system services. Start it with:
sudo /etc/init.d/cupsd start
Note: If you don’t want to leave CUPS running all the time, you can stop the service with:
sudo /etc/init.d/cupsd stop
If you are a power user, you may wish to modify the configuration file “/etc/cups/cupsd.conf”. That file will let you change certain printer settings, such as whether to enable shared printers and which type of authentication to use. If you make changes to this file while CUPS is already running, don’t forget to restart the server:
sudo /etc/init.d/cupsd restart
For more information about what you can do with the CUPS configuration file, visit the man page:
man cupsd.conf
The Web-based CUPS Interface
Once you have CUPS running, you can visit the web-based interface by opening up a browser and navigating to localhost:631
. This address indicates that the server is running locally on port 631.
To get started, plug in your printer and go to the “Administration” tab. In the “Printers” section at the top left of the page, click “Add Printer.”
The server will ask you for a username and password. You can log in as root, but if you want regular users to be able to use the printer too, you must add them to the lpadmin
group. The command to add a user to a group varies by distro; on Ubuntu, it is:
sudo usermod -aG lpadmin [username]
If you’re lucky, your printer will be detected and shown in the list of discovered local and network printers.
Select the printer and continue. For this example, we are using a USB printer, but – as you can see in the screenshot above – this can also work for a wireless printer. The CUPS interface will give you a few options for configuring the printer. Check off the box beside “Share This Printer” if you wish to allow other users on your network to access it.
Next, CUPS will attempt to autodetect your printer’s model. If it gets it wrong, you can select the correct model from the list of models that appears. If your particular model is not on the list, you can provide a PostScript Printer Definition (PPD) file. Some manufacturers may make the PPD available online for download.
Note: Some printers share the same PPD file with another model of the same family and brand. If you can’t find the PPD for your printer, check with the printer’s manufacturer for the details. You can also find a number of printer drivers at OpenPrinting.org
If you’re using a Hewlett-Packard (HP) printer, the easiest way to get CUPS to recognize it is to install Hewlett-Packard’s Linux Imaging and Printing Software (HPLIP). This collection of drivers may be included in one of your package repositories as “hplip.” Once you’ve installed it, refresh the “Add Printer” page in your browser. If all went according to plan, your HP printer should now show up in the list of supported models.
After you’ve successfully added your printer, CUPS will present you with some more configuration options. If you have a standard home printer, you’ll probably wish to change the default media size to “Letter.”
Now you can use the print dialog in any application to use the printer you set up.
When you are printing, you can go back to the CUPS administration page and click on the “Jobs” tab to view a list of running and queued print jobs.
And that’s that! Once you’ve followed the instructions above, your printer should be working in Linux.
Image credit: Open Clip Art Library
The next time you write about installing a printer under Linux, look up info that’s less than 10 years old. In modern Linux, you have a graphical front end that lets you browse software you can download from that distro’s repository, and they’re one-click installs, including CUPS (which is already included with most distros today anyhow. Now, as to printer installation: same deal – graphical front end to choose your printer, and just a few clicks to install the drivers and print a test page. Obviously you haven’t fooled with Linux since around 2000 or so.
It’s true that some distros let you easily configure printers graphically, but not all of them do. For instance, I wrote that article as a Gentoo user; Gentoo is one distro for which the user has to configure printers manually as described in the article.
Yes that’s true, but you only gave us the information that pertains to Ubuntu, and Ubuntu and Ubuntu based distributions have the graphical configuration tools available. As a consequence your instructions you gave don’t apply the majority of Linux Distributions, and probably not even to a few of the distributions that don’t offer a graphical configuration.
What about Fedora based distributions, they don’t use apt-get, nor do openSuSE based distributions, nor do Slackware based distributions.
As a consequence your article was less than helpful.
Try doing some basic research.
Say you have a win7 machine and a linux machine on your local network. On the win7 machine is a printer connected trough usb. So how are you gonna add that printer on your linux machine? I’ve spend several hours on it. In the end the LPD service did the trick!
step 1: on your win7 machine: activate LPD: (Add/remove software, turn windows features on/off) under print and document services. there you will find LPD print locservice. activate it.
step 2: on the linux machine: open cups. Cups for Admins, adding printers and classes, choose windows printer via Samba.
Setup connection like this: lpd://ipadress windows machine/NameOf YourPrinter
fill in the rest.
done.
We have a network-connected printer with a static IP address. Connecting this in Ubuntu or Mint is trivial: Linux not only finds your printer on your network before you have time to enter IP addresses or anything, but has most if not all current drivers in their repository.
Average time to install a printer for Win-anything (XP through 7): @ 15 minutes, including finding the driver for the device that wants to connect, installing said driver, finding printer by name (I can never remember what it was called)… {{sigh}}
Average time to install a printer for Ubuntu or Mint: @ 6.585 seconds, roughly. ;-)
Apple didn’t develop CUPS. They merely bought it and continued development.
sudo apt-get only applies to systems using Debian style packaging. Many Linux popular distributions use rpm (Red Hat) packages, including Fedora, Mageia, openSUSE, CentOS, ROSA, Mandriva, etc… Others use Slackware packaging and others use still different systems. These instructions are fine for Debian or Ubuntu but they don’t work for Linux in general.
The “apt-get” line is just an example of how one would install CUPS if one were running an Ubuntu- or Debian-based distro (though, as noted in previous comments, many modern Ubuntu-based distros come with CUPS pre-installed). The rest of the instructions should be distro-agnostic. While writing the article, I tested the instructions on a Gentoo-based system.
Mr. Martin is correct about Apple not developing CUPS. If Apple had developed something like this, it would never have been released under the GPL, and Linux distributions would not be using it.
Apple purchased CUPS and continues development under the GPL because that works out fine for them and prevents a fork of the code, which would benefit nobody involved. When the website says “developed by Apple,” they mean currently being developed by Apple, not originally developed by Apple. Apple doesn’t care if you get the wrong impression; it can only benefit their reputation if you think they developed CUPS.