📄 896.html
字号:
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>轻松进行linux打印</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:Joshua Drake<br>来自:Linux知识宝库<br>联系方式:无名<br><br>Joshua Drake<br>
linuxWorld 专栏作家<br>
2000 年 11 月<br>
Copyright linuxWorld ?000<br>
内容:<br>
CUPS 体验<br>
禁用打印机<br>
参考资料<br>
关于作者<br>
到目前为止,在 Unix/linux 下的打印受到太多的限制。但通过安装 CUPS 系统,您拥有一个通用打印解决方案。<br>
<br>
欢迎来到最新一期的 Ask the Geek。我在上一个专栏中提到过,这一周我们将开始一个新的系列,有关使用公共 UNIX 打印系统 (CUPS),这种打印系统可以为您的网络带来一种通用打印解决方案。<br>
<br>
Unix/linux 打印界在很长一段时间内都没有什么太大的变化。我们仍在使用古老但有效的 lpd(行式打印机守护程序),没有对 IPP(因特网打印协议)的支持,并且仍然缺乏使用许多打印机的能力。但这种状况正在迅速改变。一种新产品正对打印领域产生强烈冲击。<br>
<br>
CUPS 软件为 Unix/linux 用户提供了以有效而可靠的方式来管理打印的方法。它生来就支持 IPP,并有 LPD、SMB(服务器消息块,例如与 Microsoft Windows 连接的打印机)和 JetDirect 接口。CUPS 可以提供网络打印机浏览,它使用 PostScript 打印机描述 (PPD) 文件。一句话说,使用 CUPS,您可以象在 Windows 机器上那样方便地运行 Linux 机器上的打印机,同时拥有 Linux 的威力。<br>
<br>
CUPS 体验<br>
那么,让我们开始吧。首先,我们需要获得 CUPS。如果您运行的是 Mandrake 7.2,那么它已经存在了。(是的,这是一个无耻的建议;我在我家的机器上运行的就是它。)不过,如果您运行的是另一个发行版,需要下载它(有关发行版站点,请参阅参考资料)。<br>
<br>
下载了 CUPS 后,需要除去旧的打印软件。我将使用运行 Red Hat 6.2 的机器作为示例来说明这一过程。在这样一台机器上,在安装 CUPS 之前必须除去 lpr、printtool 和 rhs-printfilters。但需要将这些软件包备在手边,以防 CUPS 不对您不起作用。如果 CUPS 不适合您,还可以重新安装软件包,继续使用它。<br>
<br>
要除去这些软件包,输入:<br>
<br>
rpm -e lpr printtool rhs-printfilters<br>
<br>
<br>
<br>
然后通过输入以下命令来安装 CUPS:<br>
<br>
rpm -ivh cups-1.1.4-linux-2.2.14-intel.rpm<br>
<br>
<br>
<br>
要知道,您的文件名可能和这里的略有不同。<br>
<br>
现在,CUPS 就安装好了。您应当看到以下消息:<br>
<br>
cups: scheduler started<br>
<br>
它告诉您 CUPS 正在运行并等待打印作业。<br>
<br>
您可以从命令行管理 CUPS,也可以通过基于 Web 的管理器来管理。我们将通过从命令行界面添加打印机开始。以 root 用户输入:<br>
<br>
/usr/sbin/lpadmin -p LaserJet -E -v parallel:/dev/lp0 -m laserjet.ppd<br>
<br>
<br>
<br>
上面的 lpadmin 语法执行以下任务:<br>
<br>
1. 添加名为 LaserJet 的打印机 (-p)<br>
2. 启用要使用的打印机 (-E)<br>
3. 设置要使用的设备和设备类型 (-v)<br>
4. 使用驱动程序/PPD 文件 laserjet.ppd (-m)<br>
<br>
<br>
<br>
因为我们使用的是命令行,所以测试打印机最快速的方法是输入:<br>
<br>
/usr/bin/lp -d LaserJet /etc/aliases<br>
<br>
上面的 lp 语法将文件 /etc/aliases 打印到 LaserJet 打印机 (-d)。如果产生的输出是别名文件,说明一切都搞定了。当然,这是您能拥有的最简单的 CUPS 配置。<br>
<br>
还可以通过使用 -p 标志来设置打印作业的优先级。例如:<br>
<br>
/usr/bin/lp -d LaserJet -p 90 /etc/aliases<br>
<br>
<br>
<br>
通过添加 -p 90,您规定您的打印作业的优先级为 90(最高为 100)。它将在优先级低于 90 的打印作业之前打印 - 包括没有设置优先级的,缺省优先级是 50。<br>
<br>
可以从 man 页面获得 lp 命令选项的完整列表。它们除了包括上面所显示的那些,还包括一些很有用的特性,例如指定打印份数。<br>
<br>
禁用打印机<br>
我们已成功添加并测试了打印机。如果我们要禁用打印机会怎样呢?要禁用打印机,我们要使用 disable 命令:<br>
<br>
/usr/bin/disable -r "Changing Paper" LaserJet<br>
<br>
<br>
<br>
上面的 disable 语法将禁用打印机 LaserJet 并提示 "Changing Paper" 作为不可用的原因 (-r)。-r 是让人们知道打印机当前状态的一种有效手段。<br>
<br>
换好纸后,可以通过使用 enable 命令来重新启用打印机:<br>
<br>
/usr/bin/enable LaserJet<br>
<br>
<br>
<br>
接下来一个很自然的问题是:如果没有 LaserJet 会怎样?CUPS 的缺省安装带有用于 HP 和 Epson 打印机的驱动程序。这几乎可以覆盖全部个人打印机领域(佳能用户,抱歉)。如果您没有这些品牌,也别灰心。您有两个可行的选项。如果您只热衷于免费软件,可以将 Web 浏览器指向 linuxPrinting.org 网站。如果您没什么特别要求,可以购买 ESP Print Pro(请参阅参考资料)。<br>
<br>
linuxPrinting.org 网站的特色是它有许多打印机的打印机驱动程序。它还包括一个 CUPS PPD 文件制作程序。许多打印机都需要 PPD 文件。我只是很不幸选择了一款不支持的打印机,它无论从哪种目的和意图来看都只是一个镇纸 - 是的,HP LaserJet 3150。<br>
<br>
ESP Print Pro 由 Easy Software Products 开发,该公司也是 CUPS 开发的发起单位。我个人认为支持提供好产品的公司很重要。ESP Print Pro 是具有漂亮界面的 CUPS,并且支持超过 2,300 种打印机。不幸的是,除 linux 标准独立许可证以外,它的标价很高。<br>
<br>
简而言之,CUPS 配置起来并不难,并且 GPL 化版本带有基于 Web 的配置界面。ESP Print Pro 产品的主要优势在于它包括的打印机驱动程序数量众多。如果您是商家,我建议您先到 linuxPrinting.org 上看一下您的打印机是否受支持。如果不支持,我会检查 ESP。<br>
<br>
在 Ask the Geek 的下一部分中,我们将继续研究 CUPS,包括一些免费的图形管理界面(例如 KUPS)、安全性基础以及网络打印。在那之前,请您保重!<br>
<br>
您是否有困扰着您的 linux 问题?将问题在 Ask the Geek 讨论论坛中公布,或者通过电子邮件发送给我。我们可能知道怎么解答它!两周后再见。<br>
<br>
参考资料<br>
<br>
* Mandrake Software:<br>
http://www.linux-mandrake.com<br>
* 公共 UNIX 打印系统 (CUPS):<br>
http://www.cups.org<br>
* HP 的开放源码打印机站点:<br>
http://hp.sourceforge.net<br>
* linuxPrinting.org:<br>
http://www.linuxprinting.org<br>
* Easy Software Products:<br>
http://www.easysw.com<br>
<br>
关于作者<br>
Joshua Drake 是电子贸易和 linux 顾问,他拥有一间自己的公司,Command Prompt。他使用 Linux 已有 9 年时间,还是 Linux 文档项目的站长。他的其它一些项目包括 LinuxPorts.com 网站和 OpenDocs 出版公司。可以通过 joshua.drake@linuxworld.com 与 Joshua 联系。<br>
经 linuxWorld 杂志许可重新印刷。Copyright Web Publishing Inc.,该公司是 IDG Communicatioins 公司。 通过注册获得社论电子邮件。<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -