Total Pageviews

Monday 11 February 2013

How to Set Up a Printer in Linux

printing-teaserPrinting 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.
printing-CUPS
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.”
printing-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.
printing-printers-list
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.
printing-printer-config
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.”
printing-printer-config2
Now you can use the print dialog in any application to use the printer you set up.
printing-print
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.
printing-jobs
And that’s that! Once you’ve followed the instructions above, your printer should be working in Linux.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...