个人工具

UbuntuHelp:UbuntuLTSPJauntyPrinting

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 9.04

Parent: UbuntuLTSP If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Printing with local applications

This howto assumes you have already performed a default LTSP installation from the Ubuntu Alternate CD with two network cards. It also assumes all these steps from the below linked pages have been performed, resulting in an LTSP setup in which each Thin Client is successfully running local applications: https://help.ubuntu.com/community/UbuntuLTSP/LTSPLocalAppsJaunty https://help.ubuntu.com/community/UbuntuLTSP/LTSPLocalAppsFirefox https://help.ubuntu.com/community/UbuntuLTSP/ThinClientHowtoNAT/ https://help.ubuntu.com/community/UbuntuLTSP/LocalAppsResolvConf Now we are ready to add printing support for local applications. We have here two cases. In first case USB printer is added directly to the LTSP server. In another case we have remote printer in CUPS server.

Case 1: Direct added local printer

Add printing support in chroot

First we need to add printing support in the chroot.

admin-ltsp5@ubuntu-ltsp5:~$ sudo chroot /opt/ltsp/i386 apt-get install cups-bsd
[sudo] password for admin-ltsp5:
admin-ltsp5@ubuntu-ltsp5:~$ sudo ltsp-update-image

Add support in CUPS (Common Unix Printing Solution)

We have already added printer support in the LTSP server. Jaunty_Local-apps_Cups_00a.png Now we need to change CUPS to accept printing from thin clients' local applications. Jaunty_Local-apps_Cups_00b.png After the changes /etc/cups/cupsd.conf should look something similar to this:

LogLevel debug
SystemGroup lpadmin
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
DefaultAuthType Basic
<Location />
  # Allow shared printing and remote administration...
  Order allow,deny
  Allow all
</Location>
<Location /admin>
  # Allow remote administration...
  Order allow,deny
  Allow all
  Encryption Required
</Location>
<Location /admin/conf>
  # Allow remote access to the configuration files...
  Order allow,deny
  Allow all
  AuthType Default
  Require user @SYSTEM
</Location>
<Policy default>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
  # Only the owner or an administrator can cancel a job...
  <Limit Cancel-Job>
    Order deny,allow
    Require user @OWNER @SYSTEM
  </Limit>
</Policy>

Restart your CUPS after any changes.

sudo /etc/init.d/cupsys restart

Printing with Firefox and OpenOffice.org

Here are screenshots related to printing in localapps: Firefox: Jaunty_Local-apps_Cups_02.png Openoffice: Jaunty_Local-apps_Cups_03b.png Printed pages in CUPS: Jaunty_Local-apps_Cups_01.png

Case 2: Printing with remote CUPS printer

If you already have a CUPS printer server, you can use it this way. Add in lts.conf file this line under Default section. In this case LTSP server is 192.168.1.102 and CUPS server 192.168.1.101.

[Default]
CUPS_SERVER = 192.168.1.101

Do not use hostname of CUPS server! Even it is right in LTSP server's /etc/hosts file. Add remote printer to the LTSP server normal way. We have in this example USB printer in CUPS server and we have added it to the LTSP server. CUPS server: Jaunty_Local-apps_Cups_05.png Jaunty_Local-apps_Cups_07.png LTSP server: Jaunty_Local-apps_Cups_04.png Jaunty_Local-apps_Cups_06.png Both servers have this same kind of /etc/cups/cupsd.conf file.

LogLevel debug
SystemGroup lpadmin
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
DefaultAuthType Basic
<Location />
  # Allow shared printing and remote administration...
  Order allow,deny
  Allow all
  Allow 127.0.0.1
  Allow 192.168.1.0
  Allow 192.168.0.0
  Allow @LOCAL
</Location>
<Location /admin>
  # Allow remote administration...
  Order allow,deny
  Allow all
  Encryption Required
</Location>
<Location /admin/conf>
  # Allow remote access to the configuration files...
  Order allow,deny
  Allow all
  AuthType Default
  Require user @SYSTEM
</Location>
<Policy default>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>

We can check, that thin client get right CUPS server for itself.

root@ltsp201:~# cat /etc/cups/client.conf
ServerName 192.168.1.101
root@ltsp201:~#

We are now able to print from local application to the CUPS server.