Difference between revisions of "Cool Solution - Printing on a Thin Client"

From Univention Wiki

Jump to: navigation, search
(fixed static printers.conf part, and added some parts for local printers at thinclients (without building a new image))
Line 16: Line 16:
 
We will add support for local printers into the default thin-client image. So CUPS should be installed, configured (at least one local user must be allowed to add printers and share them) and set up as a service.
 
We will add support for local printers into the default thin-client image. So CUPS should be installed, configured (at least one local user must be allowed to add printers and share them) and set up as a service.
 
There are several ways to add CUPS into an image, these are some of them, next section shows how to install cups on an existing image:
 
There are several ways to add CUPS into an image, these are some of them, next section shows how to install cups on an existing image:
*The image is already built, so it should be modified and reloaded to the client(s) (explained next).
+
*without building a new UCC image
*The client(s) can be rebooted with rw support, updated and set back to ro (See UCC Manual - [http://docs.univention.de/ucc-manual-1.0.html#rollout:persistent UCC Persistent configuration and Overlayfs] sections)
+
**Install CUPS via Policy, only if you won't share a local printer for other thinclients (See UCC Manual - [http://docs.univention.de/ucc-manual-1.0.html#config:softwareupdates UCC Software updates / Installing additional software] section)
*A new image that includes the cups package can be rebuilt and rolled out to the client(s) (by adding the package 'cups' to the list, see UCC Manual - [http://docs.univention.de/ucc-manual-1.0.html#imagegen:chapter Generation of adapted images])
+
**The client(s) can be rebooted with rw support, updated, configured CUPS and set back to ro (See UCC Manual - [http://docs.univention.de/ucc-manual-1.0.html#rollout:persistent UCC Persistent configuration and Overlayfs] sections)
 +
*with building a new UCC image
 +
**The image is already built, so it should be modified and reloaded to the client(s) (explained next).
 +
**A new image that includes the cups package can be rebuilt and rolled out to the client(s) (by adding the package 'cups' to the list, see UCC Manual - [http://docs.univention.de/ucc-manual-1.0.html#imagegen:chapter Generation of adapted images])
  
 
== Modification of the image  ==
 
== Modification of the image  ==
Line 40: Line 43:
  
 
=== Configuration ===
 
=== Configuration ===
 
==== Add predefined printers ====
 
 
In case you know which printers will be available for the users you could simply add then into (/mnt/img)/etc/cups/printers.conf
 
 
You will need to know the details of your Printer. (i.e. add one entry for each printer) This is an example of a generic printer (raw queue):
 
 
<Printer GenericUSBPrinter>
 
Info Generic raw-queue printer
 
Location building B3-2
 
DeviceURI usb://<make>/<model>?serial=<number>
 
State Idle
 
StateTime 1396866947
 
Type 4
 
Accepting Yes
 
Shared Yes
 
JobSheets none none
 
QuotaPeriod 0
 
PageLimit 0
 
KLimit 0
 
OpPolicy default
 
ErrorPolicy retry-job
 
</Printer>
 
 
[https://forge.univention.org/bugzilla/attachment.cgi?id=5297 Here] is another example of a printers.conf for the same printer
 
<make>: HP
 
<model>: Deskjet%206940%20series
 
<serial>:MY79OBS0FJ04Q9
 
* '''Hint I: DeviceURI usb:''' use lpinfo -v in a running system with the printer connected to find out these parameters for your printer.
 
* '''Hint II: Driver -> MakeModel:''' The MakeModel line specifies the driver (none for a raw queue). [https://forge.univention.org/bugzilla/attachment.cgi?id=5297 this example] uses an HP driver "MakeModel HP DeskJet Series".
 
<nowiki># For Example: (In most cases, a generic driver like "MakeModel Generic PCL Laser Printer" should work.) </nowiki>
 
<Printer Generic_USB_PCL_Printer_ABC321>
 
Info Generic USB PCL Printer
 
Location Building A-B-01
 
'''MakeModel Generic PCL Laser Printer'''
 
'''DeviceURI usb://MANUFACTURER/Model%20ABC321?serial=A1B2C3'''
 
State Idle
 
StateTime 1396966131
 
Type 12356
 
Accepting Yes
 
Shared Yes
 
JobSheets none none
 
QuotaPeriod 0
 
PageLimit 0
 
KLimit 0
 
OpPolicy default
 
ErrorPolicy retry-job
 
</Printer>
 
  
 
==== Share printers ====
 
==== Share printers ====
Line 93: Line 48:
 
  ~# nano -w '''/mnt/img/etc/cups/cupsd.conf'''
 
  ~# nano -w '''/mnt/img/etc/cups/cupsd.conf'''
 
To allow other to see local printers: Change ''Browsing'' to 'On' and add the following lines
 
To allow other to see local printers: Change ''Browsing'' to 'On' and add the following lines
 +
 +
# Only listen for connections from the local machine.
 +
  '''Port 631'''
 +
  '''Listen /var/run/cups/cups.sock'''
  
 
  # Show shared printers on the local network.
 
  # Show shared printers on the local network.
Line 111: Line 70:
  
 
In nano, use Ctrl­ X to exit, answer "yes" to save and hit ENTER
 
In nano, use Ctrl­ X to exit, answer "yes" to save and hit ENTER
 
Here is an example of cups configuration file with the settings described in this article: [https://forge.univention.org/bugzilla/attachment.cgi?id=5299 cupsd.conf]
 
  
 
==== Create a local administrator ====
 
==== Create a local administrator ====
Line 157: Line 114:
  
 
===Add a new printer manually===
 
===Add a new printer manually===
 +
In normal environments this process is automatically done by CUPS. You can find your printer under '''Printers'''.
 +
 +
If not:
 
Under '''Printers''' click '''Add printer'''.
 
Under '''Printers''' click '''Add printer'''.
  
Line 166: Line 126:
  
  
In order to save this configuration, the image must be saved with these new CUPS configuration files (mainly 'cupsd.conf' and 'printers.conf' in /etc/cups. See the UCC doc as well: [http://docs.univention.de/ucc-manual-1.0.html#rollout:persistent UCC Persistently stored system settings])
+
In order to save this configuration, the image must be saved with these new CUPS configuration files (mainly 'cupsd.conf' in /etc/cups. See the UCC doc as well: [http://docs.univention.de/ucc-manual-1.0.html#rollout:persistent UCC Persistently stored system settings])
  
 
==Set up the remote server and send printing jobs==
 
==Set up the remote server and send printing jobs==

Revision as of 13:28, 20 June 2014

Produktlogo UCC Version 1.0

Note: Cool Solutions are articles documenting additional functionality based on Univention products. Not all of the shown steps in the article are covered by Univention Support. For questions about your support coverage contact your contact person at Univention before you want to implement one of the shown steps.

Also regard the legal notes at Terms of Service.


This article shows how to use a printer connected to an UCC thin client.

We will see how to enable support for local printers on the thin client and manually configure printer redirection from an UCS print server, or for its use from a remote XenApp session.

Introduction

Univention Corporate Client (UCC) is a solution for the central operation and administration of desktop PCs, notebooks, thin clients or kiosk systems. Clients are typically deployed (rolled out) via images. A thin client image offers a minimal desktop for remote sessions (e.g. RDP, Citrix XenApp or UCS).

Redirecting a printer on the client computer to a print server would allow printing jobs from other computers (eg. RDP server) to be printed on the thin client. This is also useful in a Home Office environment for example.

Thin client as a local print server

The idea is to install a local printing server (CUPS) on the thin client. It will manage printers that can then be used from a remote session or shared with a remote printing server.

Getting CUPS into the thin client

We will add support for local printers into the default thin-client image. So CUPS should be installed, configured (at least one local user must be allowed to add printers and share them) and set up as a service. There are several ways to add CUPS into an image, these are some of them, next section shows how to install cups on an existing image:

  • without building a new UCC image
  • with building a new UCC image
    • The image is already built, so it should be modified and reloaded to the client(s) (explained next).
    • A new image that includes the cups package can be rebuilt and rolled out to the client(s) (by adding the package 'cups' to the list, see UCC Manual - Generation of adapted images)

Modification of the image

In next examples we will install the needed extra packages into an existing image. Follow the instruction in this article to open an existing image for modification.

Installation

CUPS will use around 50MB once installed, but for the installation process, around 200MB free are needed.

~# apt-get -y --force-yes --no-install-recommends install cups cups-bsd
  • Note I: cups-bsd for XenApp. The previous command installs BSD commands as well, useful to print from XenApp sessions. Citrix Receiver uses the lpr command for remote jobs, which is part of cups-bsd (a suggested package).
  • Note II: dpkg Errors. dpkg will try to start the cups service after installation, showing errors:
start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
invoke-rc.d: initscript cups, action "start" failed.

This is not a real problem in the chroot environment. The cups service should start properly once is rolled out and booted (the post-installation script invokes Upstart outside the chroot: UCS, which instead uses Init more here).

optionally, clean out retrieved packages:

~# apt-get clean

Configuration

Share printers

Since the service is not running, we won't be able to use cupsctl within the chroot environment, instead we will edit the configuration file:

~# nano -w /mnt/img/etc/cups/cupsd.conf

To allow other to see local printers: Change Browsing to 'On' and add the following lines

# Only listen for connections from the local machine.
 Port 631
 Listen /var/run/cups/cups.sock
# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS dnssd
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS dnssd

To share printers to the local network or to other networks, go to '<Location />' and change Allow to '@LOCAL' or to 'all'

# Restrict access to the server...
<Location />
  Order allow,deny
  Allow all
</Location>

and comment out the lines 'Order allow,deny' in <Location /admin> and <Location /admin/conf>

In nano, use Ctrl­ X to exit, answer "yes" to save and hit ENTER

Create a local administrator

If you want to allow users to manage printers, grant a local user permissions to administer CUPS: (the local root account is also a CUPS administrator)

~# useradd -s /bin/false -G lpadmin cupsadmin
~# echo cupsadmin:Adm1n*pr1nt | chpasswd --crypt-method SHA512

Close Image

  • Note III: sync disks. Don't forget to run 'sync' to force a commit before leaving the chroot environment ('exit').
~# sync && exit

Unmount the image, it can now be rolled-out to the thin client, and restarted.

~# umount /mnt/img


Configuration on a UCS print server

By now the thin client should have an updated image with a CUPS server. Please verify it by opening http://localhost:631 on the thin client. Steps to add a printer, share it with the network and use it from a remote print server are described next.

Plug in and set up a local print queue

CUPS is able to recognize and manage USB/LPT printers connected locally. To test it, please make sure your printer is turned on and plugged.

Go to Administration on the Web interface. CUPS will ask for an authorized username (cupsadmin) and its password (Adm1n*pr1nt).

Add a new printer manually

In normal environments this process is automatically done by CUPS. You can find your printer under Printers.

If not: Under Printers click Add printer.

After that, your printer should appear under Local Printers:, please select it and click Continue

On the second prompt make sure you thick off the box for Sharing: [] Share This Printer. Follow the prompts and choose the family of drivers for your printer. (See: CUPS documentation for further details).

Since it's shared with IPP, the local printer can now process printing jobs from other computers!


In order to save this configuration, the image must be saved with these new CUPS configuration files (mainly 'cupsd.conf' in /etc/cups. See the UCC doc as well: UCC Persistently stored system settings)

Set up the remote server and send printing jobs

With a local printing queue accessible from the network, the UCS Master can set up the printer on the print server and share it from there. We can follow the instructions on UCS Creating a printer share.

Add a new printer on a UCS Master
See the queue on a Print Server


We will need:

  • The name of the printer you used on the thin client (here: hp-4960).
  • The IP addresses or FQDN of both, print server (here: server1.example.qa) and thin client (here: thinclient04.example.qa)
  • A name for the new UCS-shared printer (here: hp4960ex)

Basically, we are telling the UCS master server that server1.example.qa will share a printer that is on thinclient04.example.qa. Such queue exists as ipp://thinclient04.example.qa/printers/hp-4960 and is going to be available to the UCS network as hp4960ex

References

Personal tools