Setup a CUPS Printer on Linux
Setting up all CUPS printers available from print.cs
17Jan2016
- Note
- We suggest using the Add Printers manually given that printing via cups.cs can hide some common problems, see: DirectPrintingOnLinux
Using cup.cs.uwaterloo.ca to manage printing for 13.04 and later
- This method has the advantage of setting up all printers automatically however the disadvantage is that many common printer problems are hidden from the user
- So we recommend you follow the section below called: see:* DirectPrintingOnLinux for each printer you want to print to
- For Linux versions after 13.04 the configuration file is called /etc/cups/cups-browsed.conf
- Edit vi /etc/cups/cups-browsed.conf and add these lines:
Browsing On
BrowsePoll print.cs.uwaterloo.ca
BrowseInterval 3600
BrowseTimeout 7200
- service cups-browsed restart
Using cup.cs.uwaterloo.ca to manage printing for 12.10 and earlier
- This method has the advantage of setting up all printers automatically however the disadvantage is that most all printer problems are hidden from the user * So we recommend you follow the section below called: see:* DirectPrintingOnLinux for each printer you want to print to
- open a shell terminal
- sudo bash (this will give you a root shell)
- With your preferred editor, edit: /etc/cups/cupsd.conf and update The Browsing section
- * /etc/init.d/cups restart - or - /etc/init.d/cups restart on older systems
Full CUPS package Install
Ubuntu 14.04 and 16.04
17Jan2016
- apt-get update
- apt-get install hplip cups cups-browsed cups-bsd cups-client cups-common cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers cups-pk-helper cups-ppdc cups-server-common
Ubuntu 13.04
- apt-get update
- aptitude install --with-recommends cups-daemon cups-client cups-browsed cups
- aptitude install --with-recommends bluez-cups cups-bsd cups-common cups-driver-gutenprint cups-filters cups-pdf cups-ppdc cups-pk-helper ghostscript-cups printer-driver-gutenprint printer-driver-hpcups printer-driver-postscript-hp python-cups python-cupshelpers
Setting the default printer
lpadmin -d lj_csgrad (for grad student workstations)
lpadmin -d lj_cs (for faculty workstations)
Viewing local printers
Refreshing your printers - when nothing shows up
- Open a terminal
- sudo service cups-browsed restart
Adding Printers manually using direct to printer printing
17Jan2016
* See:
DirectPrintingOnLinux
- ) This method has the advantage that the user gets direct feed back from the printer if a problem occurs
- ) The printer address can also be used in a web brower to determine the status of the printer itself
GNOME desktop environment
This is a manual example of manually adding a printer from a cups server
You should always try the method in the previous section first - way easier to do!
- Open a web browser to find a list of the CUPS "printers" and "classes" you can access
- Example "printers": open
http://print.cs.uwaterloo.ca:631/printers
right click on the printer name - this is actually a link that you will need, example http://print.cs.uwaterloo.ca:631/printers/lj_cs
- Example "classes": open
http://print.cs.uwaterloo.ca:631/classes
right click on the class name - this is actually a link that you will need, example http://print.cs.uwaterloo.ca:631/printers/lj_csgrad
* To add the CUPS printer from Gnome
-
- System->Administration->Printing (from the top task bar on the Ubuntu/Gnome/Desktop)
- Add
- Network Printer
- Internet Printing Protocol
- Host: print.cs.uwaterloo.ca
- Queue: /printers/lj_cs
- Verify (this should work)
- Forward
- Choose Driver
- Makes: HP (Choose Manufacturer - if not listed try Generic)
- Models: HP LaserJet 4100 (Choose your model)
- Drivers: HP LaserJet 4100 Foomatic/Postcript (Foomatic Postscript is the most common default)
Useful CUPS command line utils
- lpstat - list printer status
- -p list printers
- -l -p - list printers verbose
- lpadmin - admin/update printers
- -d queue - set queue as default
- -x queue - delete queue
- /etc/init.d/cupsys restart - restart cups server on Ubuntu
- /etc/init.d/cups restart - restart cups server on Fedora Core or Redhat Systems
Notes only for Administrators
- Yet another way for clients to see printers. Rather than clients polling the print server, it is possible for the server to send packets per host, i.e., a point-to-point information transmission but this would entail adding a lot of extra configuration to the server which would be difficult to maintain properly.
Ubuntu Prior to 8.04 notes
Local Linux CUPS Setup
- /etc/group - add cscf-adm to lpadmin group
- /etc/hosts.allow - add any administrative hosts to hosts.allow
- /etc/cups/cupsd.conf - add administrative hosts to <Location admin> section and <Location /> section
Example Changes to /etc/cups/cupsd.conf
Note you may wish to set the
SystemGroup directive to your local printer admin with this directive (
lp in this example ):
SystemGroup lp - This controls which user or users can do Administrative tasks -
CUPS typically defaults to
sys which is not the
lp admin of most default Linux distros
- Make sure you add your userid to the lp group if you want to log in and do admin tasks
Warning use addgroup in Ubuntu , or groupadd -o in Fedora to add yourself - if the system is using se_linux security!
Redhat /etc/cups/cupsd.conf
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
#CSCF - asimov MIKE GORE
Allow From 129.97.15.251
</Location>
<Location /admin>
#
# You definitely will want to limit access to the administration functions.
# The default configuration requires a local connection from a user who
# is a member of the system group to do any admin tasks. You can change
# the group name using the SystemGroup directive.
#
#
AuthType Basic
AuthClass System
## Restrict access to local domain
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
# CSCF Mike Gore - add a remote machine for access
Allow From 129.97.15.251
#Encryption Required
</Location>
Ubuntu and Cups (Breezy Release - 5.10)
- Reading
/usr/share/doc/cupsys/
is very helpful,
- Cups must run as root if you are trying to connect via LPD to our printers as managed by
print.cs
To do this the parameter RunAsUser
in /etc/cups/cupsd.conf
must be set to No
. Restart cupsd by running /etc/init.d/cupsys restart
,
- In order to use the web interface you must authenticate with a userid that is in the group
lpadmin
and the Admin access portion of /etc/cups/cupsd.conf
must look the same as the RedHat example above. You should now be able to login using the UNIX passwd.
- Do not use gnome-cups-manager as it's not as flexible as the web interface.
Ubuntu and Cups (Dapper Release - 6.06)
- The
RunAsUser
directive has been deprecated in Dapper. Initial investigations show that cupsd starts up as a non root user which means the that it no longer immediately clear how to print to print.cs via the lpd backend of cups.
CUPS queue setup example for LJP_CS - DC2320 HP4100 PS
- open browser to http://127.0.0.1:631
- Add New Printer
- LJP_CS
- DC2320
- CS Printer in DC2320
- Device or LJP_CS
- Device URI for LJP_CS
- Device URI: ipp://print.cs.uwaterloo.ca/lj_cs
or ipp://print.cs.uwaterloo.ca/printers/lj_cs
- Model/Driver
- Configure Printer (under main menu for printer)
- Set Extra , General , Banner Options to suite
CUPS queue setup example for Xerox 128 in DC2560A cscflp01.cscf.uwaterloo.ca
CUPS web interface method
- open browser to http://127.0.0.1:631
- Add New Printer
- Device or RICOH_DC2560A
- Device URI for RICOH_DC2560A
- Device URI: socket://cscflp01.cscf.uwaterloo.ca
- Model/Driver
- Configure Printer (under main menu for printer)
- Set Extra , General , Banner Options to suite
Testing
Setting Default Printer
Test Page
- Open Cups Printers Menu - http://127.0.0.1:631/printers
- Under your printer name pick the Print Test Page button
- In a terminal window type lpq - you should see you new print queue
- In a terminal window type echo hello world | lpr - this should print the message to the printer
Debugging
- If the printout fails to print check the log files under /software/lpr/spool/ on print.cs or print.math - look under the directory with the same queue name as the printer
Printing queue debugging on the local machine
FYI, we been noticing cases where a print job gets stuck on Ubuntu 10.04LTS that the normal system tools can't fix - the printer may show an error state that can appear to be fixed
- System -> Administration -> Printing ->
printer name
-> Show Queue might show an empty queue when it's not.
- lprm will appear to work and even show an empty queue put the printer will still show an error status.
- /etc/init.d/cups restart won't fix it
- Using the Cups web interface: http://localhost:631/printers to clear the queue will appear to work and show an empty queue but not work - the printer may however show an error status.
- This is how to fix these cases when all else fails
- sudo bash
- cd /var/spool/cups
- rm * (note this will delete ALL of your spooled print jobs)
- /etc/init.d/cups restart
Configuration of Printer and Page options
- Open Cups Printers Menu - http://127.0.0.1:631/printers
- Pick Configure Printer - for your printer
- Set device options as needed - ie paper size, trays, duplex - option vary based on printer
Configure your System Default Papersize
Installing PPD Files
- If you can't get a PPD file from the vendor try looking Linuxprinting.org - HERE
- If needed you can add PPD files for a new printer to your systems PPD file directory
- PPD should be compressed with gzip prior to placing in your systems PPD folder
- PPD file locations for Debian
- Files are installed in /usr/share/ppd (file need to be gziped)
- /etc/init.d/cupsys restart after you add any PPD files
- PPD file locations for Fedora
- Files are installed in /usr/share/cups/model under the corresponding language directory (file need to be gziped)
- service cups restart after you add any PPD files
HP Related CUP Drivers
PPD File Errors and Notes
- I have noticed that hp_LaserJet_4300_Series.ppd.gz causes a trailing page with a diamond on it under Fedora Core 3
Host and User access to print.cs
- For direct printing, don't forget to send email to accounts AT cs to authorize the host and userid for the printer you have setup! More recently (2007-) we print via cups.cs which avoids this problem.
(note anti-spam measure on email address)
Files and Directories
- /etc/cups
- /var/cache/cups
- Note: remote.cache resolves name collisions - so if you have a local printer definition and a remote one this keeps them unique.
- /var/spool/cups
Resources
www.linuxprinting.org - Linux Printing Documents and source for Printer PPD files
Absolute Basics For Setting Up Your Printing Network
CUPS HOWTO by Brian Stults
contribs.org - various CUPS printings documents - look for CUPS