Linux has great support for printers; the right tool for the job is called CUPS
(
In this document we will cover how to use CUPS to setup a local or networked
printer. We will not go in too much detail since the project has
When you want to install a printer on your system you need to know how your printer will be attached to your system. Is it through a local port like LPT or USB, or is it networked? And if it is, does it use the Internet Printing Protocol (IPP) or is it through the Microsoft Windows SMB-CIFS protocol (Microsoft Windows Sharing)?
The next few sections explain what minimal kernel configuration you need. Of course, this depends on how your printer is going to be attached to your system, so for your convenience we have separated the instructions:
So manoeuvre to
In the next configuration examples, we will add the necessary support
Now go to the appropriate section to configure (or check) your kernel.
The LPT port is generally used to identify the parallel printer port. You need to enable parallel port support first, then PC-style parallel port support (unless you are a SPARC user) after which you enable parallel printer support.
Device Drivers -->
<*> Parallel port support
<*> PC-style hardware
Device Drivers -->
Character Devices -->
<*> Parallel printer support
[*] IEEE 1284 transfer modes)
That's it; quit the kernel configuration and rebuild your kernel. Don't forget
to copy the new kernel image to the
Now continue with
To enable USB printing, you need USB support and USB printer support.
Device Drivers -->
USB Support -->
<*> Support for Host-side USB
(...)
--- USB Host Controller Drivers
(Select the HCD that your system uses. If you do not know which one
to select, run "lspci -v | grep HCI" from another terminal)
<*> EHCI HCD (USB 2.0) support ( or )
<*> OHCI HCD support ( or )
<*> UHCI HCD (most Intel and VIA) support
(...)
<*> USB Printer support
That's it; quit the kernel configuration and rebuild your kernel. Don't forget
to copy the new kernel image to the
Now continue with
To be able to connect to a remotely attached printer through the Internet
Printing Protocol your kernel just needs to have networking support. Assuming
your kernel has that already, continue with
Your kernel must support SMB CIFS:
File systems -->
Network File Systems -->
<*> SMB file system support (to mount Windows shares etc.)
<*> CIFS support (advanced network file system for Samba, Windows and other CIFS compliant servers)
That's it; quit the kernel configuration and rebuild your kernel. Don't forget
to copy the new kernel image to the
Now continue with
Installing CUPS with Gentoo is a breeze. CUPS has a few optional features that might interest you. To enable or disable those features, use the USE flags associated with them.
| USE flag | Impact on CUPS |
|---|---|
Check the current USE settings. If you want to deviate from your current USE
settings for CUPS alone, add the appropriate USE flags to
# emerge -pv cups [ebuild N ] net-print/cups-1.2.6 "X dbus jpeg nls pam png ppds ssl -php -samba -slp -tiff" 0 kB(For instance, to enable SAMBA support for CUPS) # nano -w /etc/portage/package.use net-print/cups samba
If you are happy with the result, have Portage install CUPS.
# emerge cups
If the printer is attached to your system locally, you need to load CUPS automatically on start-up. Make sure your printer is attached and powered on before you start CUPS.
# /etc/init.d/cupsd start # rc-update add cupsd default
The default CUPS server configuration in
In the next sections we cover a few changes that are often needed:
If you want other systems to use your printer through IPP you need to
explicitly grant access to the printer in
Open up
<Location /> Order allow,deny Allow localhost Allow 192.168.0.* Deny all </Location>
Also, you will need to specify which port CUPS listens to, so that it will respond to printing requests from other machines on your network.
Listen *:631(Make sure that localhost is commented out) #Listen localhost:631
Port 631(Make sure the next two lines are commented out) #Listen 127.0.0.1:631 #Listen localhost:631
If you are interested in remote administration, you need to grant access from
other systems than just localhost to the CUPS administration. Edit
<Location /admin>(...) Encryption Required Order allow,deny Allow localhost Allow 192.168.0.3 Deny all </Location>
Do not forget to restart CUPS after making changes to
PCL drivers send raw data to the print server. To enable raw printing on CUPS,
you need to edit
# vim /etc/cups/mime.types(Uncomment the line so that the file contains:) application/octet-stream # vim /etc/cups/mime.convs(Uncomment the line so that the file contains:) application/octet-stream application/vnd.cups-raw 0 -
Do not forget to restart CUPS after making these changes by running
If the printers are attached to a remote CUPS-powered server you can easily
set up your system to use the remote printer by changing the
Assuming the printer is attached to a system called
# vim /etc/cups/client.conf(Substitute printserver.mydomain with your print server name) ServerName printserver.mydomain
The remote system will have a default printer setting which you will be using.
If you want to change the default printer, use
(First list the available printers) # lpstat -a hpljet5p accepting requests since Jan 01 00:00 hpdjet510 accepting requests since Jan 01 00:00(Set the HP LaserJet 5P as the default printer) # lpoptions -d hpljet5p
If the printer you want to configure is remotely available through a different
print server (running CUPS) you do not need to follow these instructions.
Instead, read
If you have a USB printer or your parallel port printer was powered on when you booted your Linux system, you might be able to retrieve information from the kernel stating that it has successfully detected your printer. However this is merely an indication and not a requirement.
(For a parallel port printer) $ dmesg | grep -i print parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series(For a USB printer) $ lsusb(...) Bus 001 Device 007: ID 03f0:1004 Hewlett-Packard DeskJet 970c/970cse
To have the printer installed on your system, fire up your browser and have it
point to
Go to
The next screen asks you for the device where the printer listens to. You will have the choice of several devices. The next table covers a few possible devices, but the list is not exhaustive.
| Device | Description |
|---|---|
If you are installing a remote printer, you will be asked for the URI to the printer:
Next, select the printer manufacturer in the adjoining screen and the model
type and number in the subsequent one. For many printers you will find
multiple drivers. You can either select one now or search on
Once the driver is selected, CUPS will inform you that the printer has been
added successfully to the system. You can now go to the printer management page
on the administration interface and select
To verify if the printer is working correctly, go to the printer administration
page, select your printer and click on
If the printer does not seem to work correctly, click on
If you have no idea why your printer does not function, you might get a clue by
looking at
# tail /var/log/cups/error_log(...) E [11/Jun/2005:10:23:28 +0200] [Job 102] Unable to get printer status (client-error-forbidden)!
Many printer drivers exist; to find out which one has the best performance for
your printer, visit the
Download the PPD file from the site and place it in
Some printers require specific drivers or provide additional features that are not enabled through the regular configuration process as described above. This chapter will discuss a selection of printers and how they are made to work with Gentoo Linux.
The following printers and/or drivers are covered:
The
Gentoo's Portage Tree contains an ebuild for the gimp-print drivers. Just use
# emerge gimp-print
When the emerge process has finished, the Gimp-Print drivers will be available through the CUPS web interface.
The
(Check that the ppds USE flag is enabled) # emerge -vp hplip These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild N ] net-print/hplip-0.9.5 +X +cups +foomaticdb+ppds -qt -scanner -snmp +usb 9,255 kB Total size of downloads: 9,255 kB # emerge hplip # /etc/init.d/hplip start # /etc/init.d/cupsd restart # rc-update add hplip default
When the emerge process has finished, the printer drivers will be available through the CUPS web interface.
PPA is an HP technology that focuses on sending low-level processing to the system instead of to the printer which makes the printer cheaper but more resource consuming.
If the
# emerge pnm2ppa
Once installed, download the PPD file for your printer from the
Microsoft Windows supports IPP (Windows 9x and ME users need to
Make sure that your systems
To share the printer on the SMB-CIFS network, you must have SAMBA installed and configured correctly. How to do this is beyond the scope of this document, but we will quickly deal with the configuration of SAMBA for shared printers.
Open
[printers] comment = All printers path = /var/spool/samba browseable = no guest ok = no writable = no printable = yes public = yes printer name = hpljet5p
Now navigate to the top of the
[global](...) printcap name = cups printing = cups
Make sure you enabled the
First of all, make sure that the printer is shared on your Windows system.
Next, in the CUPS web interface, configure your printer as described previously.
You will notice that CUPS has added another driver called
Many tools exist that help you configure a printer, use additional printing filters, add features to your printing capabilities, etc. This chapter lists a few of them. The list is not exhaustive and not meant to discuss each tool in great detail.
With
To install it, emerge
# emerge gtklp
If you are having printing troubles and
Unable to convert file 0 to printable format
You need to re-emerge
# echo "app-text/ghostscript-esp cups" >> /etc/portage/package.use
Then emerge
# /etc/init.d/cupsd restart