Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15497562
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2008-04-16 13:15:00

NetworkPrintingWithUbuntu

出自Ubuntu中文

目录

[]

[] 如何在Ubuntu上使用网络打印

原文出处:官方Wiki

原文作者:

授权许可:

翻译人员:

校正人员:

贡献人员:

适用版本: 文章状态:



[] Overview(概览)

Ubuntu 5.10 (Breezy Badger) supports network printing, so you can print from either your Ubuntu machine or a Windows machine etc, to another Ubuntu machine that has a printer attached (ie a "print server"). This page covers these scenarios only.

Ubuntu 5.10 (Breezy Badger)支持网络打印,所以你可以从你的Ubuntu或Windows之类的电脑到另一台带有打印机的Ubuntu电脑(例如一台“打印服务器”)上打印。本页仅包括这些特定情形。

This page does not cover printing from Ubuntu to a printer attached to a Windows machine, ie a Windows print server. The page addresses this.

本页不包括从Ubuntu到带有打印机的Windows电脑上打印,例如一台Windows打印服务器。。

[] Background(背景)

Ubuntu uses the Common UNIX Printing System ("CUPS") to handle printing. CUPS uses the Internet Printing Protocol ("IPP") as the basis for managing print jobs and queues. The Line Printer Daemon ("LPD") Server Message Block ("SMB"), and AppSocket (a.k.a. JetDirect) protocols are also supported with reduced functionality. This page describes network printing with CUPS and IPP.

Ubuntu使用通用UNIX打印系统(缩写“CUPS”)处理打印事务。CUPS使用Internet打印协议(缩写 “IPP”)作为管理打印作业和队列的基础。通过简化的功能也支持行式打印机服务、服务器消息块和AppSocket(a.k.a. JetDirect)协议。本页用CUPS和IPP描述网络打印。

CUPS printer configuration and management is handled by the Printer Admin utility launched from the Gnome menu - System -> Administration -> Printing. In addition CUPS provides command-line commands that are similar to old Berkley and SystemV print commands such as lpq, lpstat etc. Also IPP provides web services so after you have configured CUPS appropriately, you can access the printers and jobs via your web browser.

CUPS打印机的配置和管理可以通过Gnome菜单系统 -> 管理 -> 打印下的打印机管理工具进行处理。另外,CUPS还提供了类似老的伯克利和SystemV的lpq、lpstat等打印命令的命令行指令。

When a locally attached printer is defined, eg using the Printer Admin utility, that printer is automatically published from this "print server" host to the network, depending on the server directives in the CUPS configuration file. A remote Ubuntu "client" host can then be able to see and use the printer attached to the server. The network printer automatically appears in the client's Printer Admin utility. It simply pops up if CUPS is up and configured correctly and disappears if you stop CUPS at either the Print Server or your local machine.

当定义了一个本地打印机(例如使用打印管理工具),按照服务器上CUPS配置文件的指示,这个“打印服务器”主机自动向网络发布该打印 机。远程Ubuntu“客户端”主机就可以看到和使用安装在该服务器上的打印机。网络打印机自动出现在客户端的打印管理工具上。如果CUPS启动并配置正 确它就会出现,如果你在打印服务器或本地计算机上停止CUPS它就会消失。

How To .. . .. print from one Ubuntu desktop ("client") machine to another Ubuntu ("print server") machine that has a printer connected to it.

  • ..从一个Ubuntu桌面(“客户端”)计算机打印到另一台连接有打印机的Ubuntu(“打印服务器”)计算机。

Currently, with Ubuntu 5.10 (Breezy Badger) you need to make changes with an editor to the CUPS configuration file /etc/cups/cupsd.conf for network printing to work. The following are complete working replacement examples that work for a Print Server and for a Client Machine.

目前,在Ubuntu 5.10 (Breezy Badger)上你需要使用编辑器修改CUPS配置文件 /etc/cups/cupsd.conf 来实现网络打印。以下是让服务器和客户端计算机工作的完整实例。

[] Ubuntu Print Server(Ubuntu 打印服务器)

  • This is the machine that has a printer attached to it, that you want to send print jobs to.
  • 这是你希望将打印作业送达的,装有打印机的计算机。
  • Add a local printer definition, using the Printer Admin utility (Gnome menu System -> Administration -> Printing).
  • 使用打印管理工具(Gnome菜单 系统 -> 管理 -> 打印),添加一个本地打印机的定义。
  • Reconfigure the CUPS server
  • 重新配置CUPS
    • Cups Server: /etc/cups/cupsd.conf This file is based on that supplied with Ubuntu 5.10. Comment lines have been removed. Copy it onto your system.
  • CUPS服务器:/etc/cups/cupsd.conf 这个文件是基于Ubuntu 5.10的。注释行已经被删除。将它复制到你的系统里。
# /etc/cups/cupsd.conf
# Simple CUPS configuration file for a print server
# which serves printers within a private local area network.
# - There is no need for additional security within the print server, ie only authorises people can access the machine.

# This setup also allows access to the CUPS "Administrative tasks" system
# via your web browser to
# File based on Ubuntu 5.10 (Breezy Badger) (Linux version 2.6.12-10-386)
# Server Directives are explained in /sam.html

# 25/04/2006
# DavidTangye@netscape.net

ConfigFilePerm 0600
LogLevel info
Printcap /var/run/cups/printcap
RunAsUser Yes
Port 631
Include cupsd-browsing.conf
BrowseAddress @LOCAL
BrowseAddress 10.0.0.0/8
BrowseAddress 172.16.0.0/12
BrowseAddress 192.168.0.0/16


AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL
Allow From 10.0.0.0/8
Allow From 172.16.0.0/12
Allow From 192.168.0.0/16



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL
Allow From 10.0.0.0/8
Allow From 172.16.0.0/12
Allow From 192.168.0.0/16



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL
Allow From 10.0.0.0/8
Allow From 172.16.0.0/12
Allow From 192.168.0.0/16



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL
Allow From 10.0.0.0/8
Allow From 172.16.0.0/12
Allow From 192.168.0.0/16

  • This config file should be altered if security within your local network is an issue for you.
  • 如果对你来说本地网络的安全是个问题的话,这个配置文件就应该进行调整。
  • Change the network addresses if you are part of a different network, eg on the real internet, and remove unnecessary ones.
  • 如果你是另一个网络的一部分(例如在Internet上)那么就要改变网络地址,并删除不必要的那个。
  • This config allows you to use a web browser to manage CUPS, eg set up printers, manage jobs, via "".
  • 这个配置允许你通过""的形式使用WEB浏览器管理CUPS,例如启动打印机,管理打印作业。
  • Restart CUPS
  • 重启CUPS
    • After changing this file, restart CUPS by running ...
    • . 在改变这个配置文件后,通过运行以下命令或使用Gnome菜单的系统->管理里面的服务工具重启CUPS。

sudo /etc/init.d/cupsys restart

or use the Services tool under Gnome menu System -> Administration. After CUPS is restarted the printers will immediately be found automatically by machines that are set up as per the next sections.

    • 在CUPS重新启动后,其打印机将立即自动被每一台按照下面说明进行设置的计算机发现。

[] Ubuntu Client Machine(Ubuntu 客户端计算机)

  • This is the machine you want to work on and send print jobs from.
  • 这是指你在上面工作并希望从这里发送打印作业的计算机。
  • Reconfigure CUPS
  • 重新配置CUPS
    • CUPS Client: /etc/cups/cupsd.conf Use the following file. Its features are contained in its comments.
      • CUPS客户端:/etc/cups/cupsd.conf 使用如下文件。它的特点是包含注释。
# /etc/cups/cupsd.conf
# Simple CUPS configuration file for a pure client machine:
# which has:
# - no printers of its own, (or any local printers will not be shared?)
# - no need for security within the machine, ie a personal workstation
# - a network connection to a local network, where it will find CUPS-controlled printer servers

# This setup also allows access to the "Administrative tasks" system at
#
# File based on Ubuntu 5.10 (Breezy Badger) (Linux version 2.6.12-10-386)
# Server Directives are explained in /sam.html

# 25/04/2006
# DavidTangye@netscape.net

ConfigFilePerm 0600
LogLevel info
Printcap /var/run/cups/printcap
RunAsUser Yes
### Listen fails. Use Port
#Listen 127.0.0.1:631
#Listen 10.0.0.0/8:631
#Listen 128.0.0.0/16:631
#Listen 192.168.0.0/24:631
Port 631

### Which print servers to use
Include cupsd-browsing.conf
BrowseOrder deny,allow
BrowseDeny from All
BrowseAllow from @LOCAL
BrowseAllow from 10.0.0.0/8
BrowseAllow from 172.16.0.0/12
BrowseAllow from 192.168.0.0/16


AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL



AuthType None
Order Deny,Allow
Deny From All
Allow From @LOCAL

  • Restart CUPS
  • 重启CUPS
    • After making any alterations you wish to this file, restart CUPS by running ...
    • 在对文件进行你需要的改造后,通过运行以下命令或使用Gnome菜单的系统->管理里面的服务工具重启CUPS。
sudo /etc/init.d/cupsys restart

or use the Services tool under Gnome menu System -> Administration. After CUPS is restarted, the printers on file servers, (eg, set up in the Print Servers section above) will be found automatically by your machine. They will pop up in your "Printers" screen. This might take up to 30 seconds though.

CUPS重新启动后,文件服务器上的(按照上面打印服务器一节进行配置的)打印机将被你的计算机自动发现。他们将出现在你的“打印机”屏幕上。虽然这可能要花费30秒的时间。

If you want your machine to print to printers on other Ubuntu hosts, and also to be a print server for other machines, you need to create a combination of the above two cupsd.conf files.

如果你希望你的计算机能打印到另一台装有打印机的Ubuntu主机(也是其他计算机的打印服务器),你需要创建将上述两个cupsd.conf 结合在一起的文件。

[] Windows Client Machine(Windows 客户端计算机)

  • Add the printer to the Windows client by using the Windows "Add Printer" Wizard. Type in the following in the printer URL:
  • 通过使用Windows“添加打印机”向导将打印机添加到Windows客户端。在打印机URL中输入如下内容:

  • PRINTSERVERNAME is the name or ip address of the print server,
  • PRINTSERVERNAME是打印服务器的名称或IP地址,
  • PRINTERNAME is the name given to the printer on the print server.
  • PRINTERNAME是打印服务器上分配给打印机的名称。

[] Common Problems(常见问题)

  • Print jobs stay on the client machine and do not print. Run the command 打印作业停留在客户端计算机上并且没有被打印。 运行命令

lpstat -p -d

If it reports something like ... 如果它出现象下面这样的报告


printer HP-OfficeJet-D155 is idle.  enabled since Jan 01 00:00
Network host 'alice' is busy; will retry in 30 seconds...

or it reports something like ... 或它的报告象下面这样


printer OfficeJet-D155@10.0.0.40 is idle.  enabled since Jan 01 00:00
Unable to get printer status (client-error-forbidden)!
system default destination: OfficeJet-D155@10.0.0.40
  • .. your client computer cannot obtain printer information from the server. In either case use the "/etc/cups/cupsd.conf" files as above and restart CUPS.
    • 你的客户端计算机不能获得服务器上的打印机信息。在每个问题中都试着使用如上所述的"/etc/cups/cupsd.conf" 文件并重启CUPS.


阅读(2145) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~