Home > Linux, Red Hat / CentOS > Lägg upp en skrivare i CentOS/RHEL

Lägg upp en skrivare i CentOS/RHEL

October 19th, 2010 Leave a comment Go to comments

This will add a HP JetDirect printer:

lpadmin -p printername -v socket://ipaddress_of_printer:9100

CUPS provides two methods for adding printers: a command-line program called lpadmin(8) and a Web interface. The lpadmin command allows you to perform most printer administration tasks from the command-line and is located in /usr/sbin. The Web interface is located at:

and steps you through printer configuration. If you don’t like command-line interfaces, try the Web interface instead.

Run the lpadmin command with the -p option to add a printer to CUPS:

    /usr/sbin/lpadmin -p printer -E -v device -m ppd ENTER

For a HP DeskJet printer connected to the parallel port this would look like:

    /usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd ENTER

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44 would be added with the command:

    /usr/sbin/lpadmin -p LaserJet -E -v socket://11.22.33.44 -m laserjet.ppd ENTER

As you can see, deskjet.ppd and laserjet.ppd are the PPD files for the HP DeskJet and HP LaserJet drivers included with CUPS. You’ll find a complete list of PPD files and the printers they will work with in Appendix C, “Printer Drivers”.

For a dot matrix printer connected to the serial port, this might look like:

    /usr/sbin/lpadmin -p DotMatrix -E -m epson9.ppd \
        -v serial:/dev/ttyS0?baud=9600+size=8+parity=none+flow=soft ENTER

Here you specify the serial port (e.g. S0,S1, d0, d1), baud rate (e.g. 9600, 19200, 38400, 115200, etc.), number of bits, parity, and flow control. If you do not need flow control, delete the “+flow=soft” portion.

The CUPS web server provides a user-friendly “wizard” interface for adding your printers. Rather than figuring out which device URI and PPD file to use, you can instead click on the appropriate listings and fill in some simple information. Enter the following URL in your web browser to begin:

Click on the Add Printer button to add a printer.

Ref: http://www.cups.org/doc-1.1/sam.html

Tips how to troubleshoot a deskjet printer in Ubuntu: http://www.experts-exchange.com/OS/Linux/Q_26926848.html?cid=1749

Categories: Linux, Red Hat / CentOS Tags:
  1. No comments yet.
  1. No trackbacks yet.