如何在Ubuntu上使用網路列印
出自Ubuntu中文
目錄 |
[編輯] 如何在Ubuntu上使用網路列印
原文出處:官方Wiki
原文作者:
授權許可:
翻譯人員:lightyears
校正人員:
貢獻人員:
適用版本: 文章狀態:等待校正
[編輯] Overview(概覽)
Ubuntu 5.10 (Breezy Badger)支持網路列印,所以你可以從你的Ubuntu或Windows之類的電腦到另一台帶有印表機的Ubuntu電腦(例如一台「列印伺服器」)上列印。本頁僅包括這些特定情形。
本頁不包括從Ubuntu到帶有印表機的Windows電腦上列印,例如一台Windows列印伺服器。WindowsXP印表機頁請訪問這裏。
[編輯] Background(背景)
Ubuntu使用通用UNIX列印系統(縮寫「CUPS」)處理列印事務。CUPS使用Internet列印協議(縮寫「IPP」)作為管理列印作業和隊列的基礎。通過簡化的功能也支持行式印表機服務、伺服器消息塊和AppSocket(a.k.a. JetDirect)協議。本頁用CUPS和IPP描述網路列印。
CUPS印表機的配置和管理可以通過Gnome菜單系統 -> 管理 -> 列印下的印表機管理工具進行處理。另外,CUPS還提供了類似老的伯克利和SystemV的lpq、lpstat等列印命令的命令行指令。
當定義了一個本地印表機(例如使用列印管理工具),按照伺服器上CUPS配置文件的指示,這個「列印伺服器」主機自動向網路發布該印表機。遠程Ubuntu「客戶端」主機就可以看到和使用安裝在該伺服器上的印表機。網路印表機自動出現在客戶端的列印管理工具上。如果CUPS啟動並配置正確它就會出現,如果你在列印伺服器或本地計算機上停止CUPS它就會消失。
- ..從一個Ubuntu桌面(「客戶端」)計算機列印到另一台連接有印表機的Ubuntu(「列印伺服器」)計算機。
目前,在Ubuntu 5.10 (Breezy Badger)上你需要使用編輯器修改CUPS配置文件 /etc/cups/cupsd.conf 來實現網路列印。以下是讓伺服器和客戶端計算機工作的完整實例。
[編輯] Ubuntu Print Server(Ubuntu 列印伺服器)
- 這是你希望將列印作業送達的,裝有印表機的計算機。
- 使用列印管理工具(Gnome菜單 系統 -> 管理 -> 列印),添加一個本地印表機的定義。
- 重新配置CUPS
- 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 http://localhost:631 # File based on Ubuntu 5.10 (Breezy Badger) (Linux version 2.6.12-10-386) # Server Directives are explained in http://localhost:631/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 <Location /> 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 </Location> <Location /jobs> 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 </Location> <Location /printers> 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 </Location> <Location /admin> 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 </Location>
- 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 "http://PRINTSERVERNAME:631/".
- 這個配置允許你通過"http://PRINTSERVERNAME:631/"的形式使用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 客戶端計算機)
- 這是指你在上面工作並希望從這裏發送列印作業的計算機。
- 重新配置CUPS
- 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 # http://localhost:631 # File based on Ubuntu 5.10 (Breezy Badger) (Linux version 2.6.12-10-386) # Server Directives are explained in http://localhost:631/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 <Location /> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /jobs> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /printers> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location> <Location /admin> AuthType None Order Deny,Allow Deny From All Allow From @LOCAL </Location>
- 重啟CUPS
- 在對文件進行你需要的改造后,通過運行以下命令或使用Gnome菜單的系統->管理裏面的服務工具重啟CUPS。
sudo /etc/init.d/cupsys restart
CUPS重新啟動后,文件伺服器上的(按照上面列印伺服器一節進行配置的)印表機將被你的計算機自動發現。他們將出現在你的「印表機」屏幕上。雖然這可能要花費30秒的時間。
如果你希望你的計算機能列印到另一台裝有印表機的Ubuntu主機(也是其他計算機的列印伺服器),你需要創建將上述兩個cupsd.conf 結合在一起的文件。
[編輯] Windows Client Machine(Windows 客戶端計算機)
- 通過使用Windows「添加印表機」嚮導將印表機添加到Windows客戶端。在印表機URL中輸入如下內容:
-
http://PRINTSERVERNAME:631/printers/PRINTERNAME
-
- PRINTSERVERNAME是列印伺服器的名稱或IP地址,
- PRINTERNAME是列印伺服器上分配給印表機的名稱。
[編輯] Common Problems(常見問題)
- 列印作業停留在客戶端計算機上並且沒有被列印。 運行命令
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
- 你的客戶端計算機不能獲得伺服器上的印表機信息。在每個問題中都試著使用如上所述的"/etc/cups/cupsd.conf" 文件並重啟CUPS.
- 本信息目前支持Ubuntu 5.10 (Breezy Badger)
