CUPS server setup

From Smith family
Jump to: navigation, search
Server setup
← Previous Next →
Webmail Scanner

CUPS is easy to set up.

Allow network printing

Out of the box, CUPS only allows connections from localhost. That's OK for the desktop machine, but is a bit of a problem for setting up the server. Modify /etc/cups/cupsd.conf at the top to look like this:

## Only listen for connections from the local machine.
# Listen localhost:631
# Listen for connections from anywhere
Port 631
Listen /var/run/cups/cups.sock
ServerAlias desktop.domain.tld
ServerAlias printer.domain.tld

(the ServerAlias line is needed to allow the server to respond to remote requests. Repeat this line for each alias the CUPS server responds to. See Ubuntu bug 516018 for details.)

Add the Allow @LOCAL lines in the two Location stanzas in the same file:

<Location />
 # Allow shared printing and remote administration...
 Order allow,deny
 Allow @LOCAL
</Location>
<Location /admin>
 # Allow remote administration...
 Order allow,deny
 Allow @LOCAL
</Location>

then restart CUPS:

root@server:~# service cups restart

You should then be able to point a webbrowser at desktop.server.tld:631 or server.domain.tld:631 and configure printers via the web interface.

As I have printers attached to both machines, and I want various Windows boxes to use the printers, I need to publish the printer details. On the Administration page, select these options:

  • Show printers shared by other systems
  • Share published printers connected to this system
  • Allow printing from the Internet
  • Allow remote administration
  • Allow users to cancel any job (not just their own)

Do that on both machines, and you'll be able to access either printer from either machine.

Note to self

The HP LaserJet 1320 printer I have doesn't like the "recommended" Gutenprint driver. Instead, configure it to use the HP LaserJet 1320 series Postscript (recommended). I also installed the hplip package and ran hp-setup -i .

I had trouble using Chrome for the administration (I think it couldn't handle the certificates), so I used ReKonq instead.

Update Avahi demon

The Avahi demon may not allow printing to networked printers, as the client machines may not understand the hostname.local naming convention that CUPS expects.

On Ubuntu 16.10 machines, modify /etc/nsswitch.conf so the hosts: line reads:

hosts:          files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname

On all machines, add myhostname to the end of that line.

Restart Avahi and CUPS:

root@server:~# service avahi-daemon restart
root@server:~# service cups restart

Updating HPLIP

I've got a multi-function printer (HP 1312). Scanning for this printer is not supported in the HPLIP that comes with Ubuntu. So I need to update it, as described on the Scanner setup page.

Bugfix

CUPS on Ubuntu 12.04 has a bug that affects the USB backend, preventing the printer printing more than one job with it needing resetting. Once the printer is set up, issue the command:

root@server:~# lpadmin -p <printer> -o usb-no-reattach-default=true

Windows use of printers

To allow Windows boxes to use the printers, you'll first need to create a 'raw' queue for each printer you want to make available. Then create a new printer in Windows. In the wizard, ask for a 'Printer connected to the internet', give the address as http://server.domain.tld:631/printers/RawPrinterQueueName, and install the Windows driver for that printer on the Windows box. That should be it!

For more detailed instructions on using CUPS with Windows, see this How to make Windows use CUPS IPP page.

  • Start a web browser and point it at http://printers.domain.tld:631/printers. Select the printer you want, such as http://printers.domain.tld:631/printers/RawPrinterQueueName. Copy this address to the clipboard.
  • Go to Control Panel > Add a new printer. Add a network printer. Don't bother searching for the printer, simply paste in the address you copied above.
  • Install the printer drivers as normal.

You should now have a working printer available from CUPS.