As cups is installed with the base package it’s already on the machine, it just needs to be configured, and setup to be shared through samba. The easiest way to configure cups is through the web interface, so first we need to enable that for machines other than localhost. To do this edit /etc/cups/cupsd.conf. First change the listen address to everything, not just localhost:
Next add BrowseAddress @LOCAL config after the BrowseAllow config:
# Show shared printers on the local network. Browsing On BrowseOrder allow,deny # (Change '@LOCAL' to 'ALL' if using directed broadcasts from another subnet.) BrowseAllow @LOCAL BrowseAddress @LOCAL
Next we need to enable the local subnet for all the area’s in the web interface. Find the following sections and add the Allow @Local config:
# Restrict access to the server... <Location /> Order allow,deny Allow @LOCAL </Location> # Restrict access to the admin pages... <Location /admin> Encryption Required Order allow,deny Allow @LOCAL </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny Allow @LOCAL </Location>
Then enable and start the service:
[root@tranquilpc cups]# chkconfig cups on
[root@tranquilpc cups]# service cups start
Starting cups: [ OK ]
You should then be able to go to port 631 from a web browser to start configuring cups – this is http://192.168.1.107:631 for me. The things most likely to cause confusion here are twofold:
- When you go to the admin page for the first time cups will start trying to generate a certificate (if you tail /var/log/cups/error_log the last line will be Generating SSL server key…). The server needs input to seed the key generation, and chances are nothing is happening on your box. Log in on another terminal and run find / – that should give it data to seed the key.
- Your web browser will probably need an exception added to use the self signed key.
There are two options next. You can either install the printer as a fully fledged linux printer using the linux drivers, or you can just install a RAW driver. The difference is that if you are printing from another machine if the printer driver is on the linux box then you send unformatted data for linux to turn into something the printer understands. If you setup a raw queue then you are send printer formatted stuff to linux, and it just acts as a pass through. As the windows / OS X drivers for printers tend to be a lot more advanced, then RAW makes a lot more sense.
To add the printer first connect it to the NAS, and turn it on. CUPS is pretty good at auto detecting things. Then in the admin page in the web console click on add printer. In the web interface you then need to:
- Add in a name, location and description and click on next
- The printer should appear in the devices list – choose it and continue.
- Choose Raw and continue.
- Choose Raw Queue and add printer. At this point you will get a login prompt – this can be any admin users on the NAS box. The easiest one to use is root, with the root password. This should add the printer successfully.
Next we need to share the printer. To do this edit the /etc/samba/smb.conf file. Comment out this section with hashes:
# load printers = no # printing=none # cups options = raw # printcap name = /dev/null # disable spoolss = yes
And add this in instead:
load printers = yes printing = cups cups options = raw
Then change the printer share (which should be commented out from the earlier samba configuration) to:
[printers] comment = All Printers path = /var/spool/samba browseable = yes guest ok = yes writable = no printable = yes use client driver = yes
After that save the changes and restart samba:
[root@tranquilpc samba]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
At this point you should see it in windows to set up as a network printer through the add printer wizard.