CUPS

From Schmid.wiki
Jump to: navigation, search

Contents

Installation

# emerge cups

Server Configuration

Web Interface

Setup web interface in /etc/cupsd.conf

Port 631

<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 10.1.1.0/24
</Location>

<Location /admin>
AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 10.1.1.0/24
</Location>

and then use web interface on http://localhost:631.

Add Printers

HP1022n

Looked up printer in linuxprinting.org, and found that foo2zjs was the recommended driver. Checked the package database:

eix foo2zjs
* net-print/foo2zjs
     Available versions:  20060607
     Installed:           20060607
     Homepage:            http://foo2zjs.rkkda.com/
     Description:         Support for printing to ZjStream-based printers

and did a:

echo "net-print/foo2zjs ~x86" >> /etc/portage/package.keywords
emerge foo2zjs

then installed the printer using the CUPS web interface:

  1. Printers
  2. Add Printer
  3. Name: 'hp1022n' , Description: 'HP LaserJet 1022n'
  4. Device: 'LPD/LPR Host or Printer' (the only one that worked for me)
  5. Device URI: 'socket://10.1.1.8:9100'
  6. Make: 'HP'
  7. Model: 'HP LaserJet 1022 Foomatic/foo2zjs (recommended) (en)'

Client Configuration

Set ~/.lpoptions:

Default hp1022n page-left=19 cpi=13 lpi=7 prettyprint=true media=A4 page-top=30 page-bottom=24

Print using these commands:

lpr somefile.pdf
lp -P 1-3 somefile.pdf # page 1,2,3

On other machines on network, set CUPS server in .bashrc:

export CUPS_SERVER=xxx.yyy.zzz.xxx

Old Stuff

Printing From Linux to Windows Shared Printer

First, you need to share the printer. Make sure the sharename is one word, like 'laser'.

Try to find it with the Samba client:

# smbclient -L windows_box -N
Domain=[LINNE] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
       Sharename       Type      Comment
       ---------       ----      -------
       shared          Disk
       laser           Printer   HP LaserJet 4L   <- there it is!
       ...
Domain=[WINDOWS_BOX] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
...

Then you need to find a suitable .ppd-file on http://www.linuxprinting.org/printer_list.cgi

# cp some_driver.ppd /usr/share/cups/model/
# lpadmin -p laser -v smb://windows_box/laser -P /usr/share/cups/model/some_driver.ppd  <- add printer
# /usr/bin/enable laserjet   <- start printer
# accept laserjet            <- accept print jobs
# lpadmin -d laser           <- make it the default printer

Examples

./configurationCount.py|lpr -Pe21a -olandscape

References

Personal tools