Print this Page

Home Server CUPS printing

Index.

 

Introduction.

Today CUPS is the standard print server on Linux. CUPS does work together with Samba which is used for the SMB file serving for Windows clients. This means that printers connected to the Home Server, or network printers that the Home Server can reach, can be made available to other Linux and Windows systems. We make a virtual PDF printer available too. You should (or must) read the Arch Wiki about CUPS too, specially the part about the drivers which are not installed in this article.

 

Configuration.

Install cups and cups-pdf:

[root@homsrv ~]# pacman -S cups cups-pdf
resolving dependencies...
looking for inter-conflicts...

Targets (54): openslp-1.2.1-3  libtasn1-2.9-1  gnutls-2.12.6.1-1
              libjpeg-turbo-1.1.1-1  libtiff-3.9.5-1  libpng-1.4.5-1
              libdaemon-0.14-1  xcb-proto-1.6-2  xproto-7.0.21-1
              libxdmcp-1.1.0-1  libxau-1.0.6-1  libxcb-1.7-2  kbproto-1.0.5-1
              libx11-1.4.3-2  dbus-1.4.8-1  avahi-0.6.30-3  libcups-1.4.6-3
              xextproto-7.2.0-1  libxext-1.3.0-1  libice-1.0.7-1  libsm-1.2.0-1
              libxt-1.1.1-1  libxmu-1.1.0-1  xorg-xset-1.2.1-2
              xdg-utils-1.1.0rc1-2  freetype2-2.4.4-2  fontconfig-2.8.0-1
              renderproto-0.11.1-1  libxrender-0.9.6-1  pixman-0.22.0-1
              cairo-1.10.2-2  openjpeg-1.3-3  lcms-1.19-1  poppler-data-0.4.4-1
              poppler-0.16.5-1  hicolor-icon-theme-0.12-1  cups-1.4.6-3
              inputproto-2.0.2-1  libxi-1.4.2-1  xf86vidmodeproto-2.3.1-1
              libxxf86vm-1.1.1-1  libdrm-2.4.25-1  fixesproto-5.0-1
              libxfixes-5.0-1  damageproto-1.2.1-1  libxdamage-1.1.3-1
              libgl-7.10.3-1  dri2proto-2.3-1  glproto-1.4.12-1  mesa-7.10.3-1
              freeglut-2.6.0-1  jasper-1.900.1-6  ghostscript-9.02-2
              cups-pdf-2.5.1-1

Total Download Size:    25.80 MB
Total Installed Size:   127.83 MB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 openslp-1.2.1-3-i686    261.9K  481.1K/s 00:00:01 [######################] 100%
 libtasn1-2.9-1-i686     105.4K  443.5K/s 00:00:00 [######################] 100%

     ... Long output list deleted ...

(37/54) installing cups                            [######################] 100%
>> If you use an HTTPS connection to CUPS, the first time you access
>> the interface it may take a very long time before the site comes up.
>> This is because the first request triggers the generation of the CUPS
>> SSL certificates which can be a very time-consuming job.
Optional dependencies for cups
    php: for included phpcups.so module
    ghostscript: for non-PostScript printers to print with CUPS to convert
    PostScript to raster images
    foomatic-db: drivers use Ghostscript to convert PostScript to a printable
    form directly
    foomatic-db-engine: drivers use Ghostscript to convert PostScript to a
    printable form directly
    foomatic-db-nonfree: drivers use Ghostscript to convert PostScript to a
    printable form directly
(38/54) installing inputproto                      [######################] 100%
(39/54) installing libxi                           [######################] 100%
(40/54) installing xf86vidmodeproto                [######################] 100%
(41/54) installing libxxf86vm                      [######################] 100%
(42/54) installing libdrm                          [######################] 100%
(43/54) installing fixesproto                      [######################] 100%
(44/54) installing libxfixes                       [######################] 100%
(45/54) installing damageproto                     [######################] 100%
(46/54) installing libxdamage                      [######################] 100%
(47/54) installing libgl                           [######################] 100%
(48/54) installing dri2proto                       [######################] 100%
(49/54) installing glproto                         [######################] 100%
(50/54) installing mesa                            [######################] 100%
Optional dependencies for mesa
    opengl-man-pages: for the OpenGL API man pages
(51/54) installing freeglut                        [######################] 100%
(52/54) installing jasper                          [######################] 100%
(53/54) installing ghostscript                     [######################] 100%
Optional dependencies for ghostscript
    texlive-core: needed for dvipdf
    gtk2: needed for gsx
(54/54) installing cups-pdf                        [######################] 100%
-------------------------------------------------
To use cups-pdf, restart cups and visit the cups
web interface at http://localhost:631/

You can now add a "Virtual Printer (PDF Printer)"
and use the Postscript/Generic postscript color
printer driver.

Note that cups-pdf has a configuration
file in /etc/cups. The default location for
pdf output is /var/spool/cups-pdf/$username.
-------------------------------------------------
[root@homsrv ~]#

Now if you didn’t had dbus already installed on your server, you should start it now:

[root@homsrv ~]# /etc/rc.d/dbus start
:: Starting D-BUS system messagebus                                      [DONE]
[root@homsrv ~]#

Before you start the CUPS server, make some changes to /etc/cups/cupsd.conf so that you can configure the server from a workstation. Default the CUPS server is only reachable from localhost. The changes are bold printed.

# Only listen for connections from the local machine and LAN.
#Listen localhost:631
Listen 127.0.0.1:631
Listen [::1]:631
Listen 10.126.160.253:631
Listen [2001:1af8:fecf:7ea0::fd]:631
Listen /var/run/cups/cups.sock

# Restrict access to the server...
<Location />
    Order allow,deny
    Allow from @IF(lo)
    Allow from @IF(br0)
</Location>
<Location /admin>
    Order allow,deny
    Allow All
</Location>

Now you may start the CUPS server:

[root@homsrv ~]# /etc/rc.d/cups start
:: Starting CUPS Daemon                                                  [DONE]
[root@homsrv ~]#

Now point a browser to http://homsrv.wpl.ym:631/ and add a printer. To make the printer usable from Linux clients, make this printer shareable, and in the Administration page enable “Share printers connected to this system” too. To confirm your actions use the root account and password when asked to login.

On your Linux management workstation, if you install CUPS there too (only the cups package), start it and browse to http://localhost:631/ on your workstation you should see the printer(s) connected on the Home Server.

Don’t forget to add dbus and cups on the Home Server /etc/rc.conf file.

 

PDF printing.

Together with cups we installed cups-pdf. This is a simple virtual printer that can accept plain text files and convert that to PDF files, but does accept PDF jobs too and prints these as they are. The configuration will be so that the print jobs end up in each users own subdirectory of their home directory. In fact solution this is a free alternative for Adobe’s Distiller.

A condition to let this work is that each user on your network needs to have an account on the Home Server, and that this name is exactly the same on the Home Server and client computer.  So, your Windows client computers need to use user names that are compatible with Linux. This is a good idea for other things too as you will see in other articles.

The only thing to make this work is to configure /etc/cups/cups-pdf.conf:

###########################################################################
#                                                                         #
# Path Settings                                                           #
#                                                                         #
###########################################################################

### Key: Out
##  CUPS-PDF output directory
##  special qualifiers:
##     ${HOME} will be expanded to the user's home directory
##     ${USER} will be expanded to the user name
##  in case it is an NFS export make sure it is exported without
##  root_squash!
### Default: /var/spool/cups-pdf/${USER}

Out /${HOME}/prints

### Key: AnonDirName
##  ABSOLUTE path for anonymously created PDF files
##  if anonymous access is disabled this setting has no effect
### Default: /var/spool/cups-pdf/ANONYMOUS

AnonDirName /mnt/users/prints

### Key: Label
##  label all jobs with a unique job-id in order to avoid overwriting old
##  files in case new ones with identical names are created; always true for
##  untitled documents
##  0: label untitled documents only
##  1: label all documents with a preceeding "job_#-"
##  2: label all documents with a tailing "-job_#"
### Default: 0

Label 1

Only the relevant changes are shown. You don’t need to create these output directories, they will be created when needed. The AnonDirName on the generic users filesystem is to catch cases where the user name mapping fails or the print job is anonymous.

 

Download.

Here is the updated archive with configuration files.

Linux Home Server complete package
Linux Home Server complete package
homeserver-complete.tar.gz
2.6 MiB
7 Downloads
Details...

Permanent link to this article: http://www.mbse.eu/linux/homeserver/essential/printserver/