linux配置网络打印机.docx
- 文档编号:11957864
- 上传时间:2023-04-16
- 格式:DOCX
- 页数:9
- 大小:27.21KB
linux配置网络打印机.docx
《linux配置网络打印机.docx》由会员分享,可在线阅读,更多相关《linux配置网络打印机.docx(9页珍藏版)》请在冰豆网上搜索。
linux配置网络打印机
前段时间办公室申请换打印机的时候,很想换一台支持网络打印的,网上查了查感觉
HP2015DN还不错,属于价格适中量又足的那种。
不过一般采购的事情是自己做不了主的,最终送来的是HP2015DUSB接口的连线都得再掏钱买,这HP也够黑的。
仅仅差了一个N,结果网络打印的功能就泡汤了。
不过还好,HP2015D起码是台PDL打印机,可以在Linux上用p910nd这个软件包来实现网络打印机功能(以前用的那种烂GDI打印机,只能在Windows下用),其性能是Windows下的打印共享所不能比的。
具体做法如下:
1、找一台从其他部门退役下来申请报废的破PC装个Linux,设置好IP地址确认能被其他计算机访问到,把打印机的USB连接线接到这台计算机上
2、安装P910nd软件包:
a)、在这里下载p910nd:
b)、解压缩并进入源代码目录:
tarjxvfp910nd-0.92.tar.bz2;cdp910nd-0.92
c)、编译安装:
make最终产生的目标文件是/usr/sbin/p910nd
d)、确认usb设备已经创建(一般在Linux系统安装时就创建好了):
1s-l/dev/usb
|grepIpO,应该会返回一行信息如:
crw-rw----1rootlp180,012-2613:
22IpO
e)、如果没有返回信息,则创建之:
mknod/dev/usb/lp0c1800
f)、启动服务进程:
/usr/sbin/p910nd-f/dev/usb/lp00
g)、把上述命令写入/etc/rc.local,每次开机时自动运行
3、在其他需要使用打印机的计算机上用以下方法安装打印机,以WindowsXP为例:
a)、在添加打印机向导中选择连接到此计算机的本地打印机”,确认不要选自
动检测并安装即插即用打印机
b)、选择创建新端口”端口类型选StandardTCP/IPPort”
c)、打印机名或IP地址填上述Linux主机的IP地址
d)、选自定义”,点设置”按钮,确认协议”为Raw端口号”为9100
e)、安装打印驱动程序,厂商选HF”,打印机选HPLaserJetP2015SeriesPCL6”
f)、确认将新添加的打印机设置为默认打印机
虽然是台破PC但单纯用做打印服务器也实在是太浪费资源了,再配置一下samba
把剩余的磁盘空间用做部门内的共享服务器,报废的计算机又可以继续发挥余热啦。
设备:
水星MW4530R8无线路由器,惠普HPMFPM1005打印一体机。
固件:
OpenWrtBarrierBreaker14.07r44382byHaxc;惠普HPMFP
M1005打印一体机打印机固件采用hplj固件
http:
//oleg.wl500g.info/hplj/。
F面是安装设置教程:
1、路由器端安装打印机服务器
通过putty软件SSH登陆到路由器安装,如果你安装了上述的openwrt
固件,可略过此步骤,里面已经集成了。
opkgupdate
opkginstallkmod-usb-printerusbutilsp910ndluci-app-p910nd
2.安装打印机固件
HP的低端打印机自身不带打印固件,每次连接pc时固件会从pc加载
到打印机中。
博主的HPMFPM100蹴属于这种。
通过putty软件SSH登陆
cd/usr/lib/
wgethttp:
//oleg.wl500g.info/hplj/sihp1005.dl
-每次打印机上电要自动加载这个驱动固件:
•打开编辑器:
vi/etc/hotplug.d/usb/20-printer
输入:
#############################################
#!
/bin/sh#changethistothelocationwhereyouputthe.dlfile:
FIRMWARE=/usr/lib/sihp1005.dl
DEVICE=/dev/usb/lpO
LOGFILE=/var/log/printer
if["$PRODUCT"="3f0/3b17/100"-a"$ACTION"="add"-a
"$DEVTYPE"="usb_interface"];then
echo"$(date):
STARTING">$LOGFILE
foriin$(seq30);do
echo"$(date):
Attemptnumber$ion$DEVICE">>
$LOGFILE
if[-c$DEVICE];then
echo"$(date):
Device$DEVICEfound.">>$LOGFILEif[-z"'usb_printerid$DEVICE|grepFWVER"];
then
echo"$(date):
Nofirmwarefoundon
$DEVICE">>$LOGFILE
echo"$(date):
Sendingfirmwareto
printer...">>$LOGFILE
cat$FIRMWARE>$DEVICE
echo"$(date):
done.">>$LOGFILE
else
echo"$(date):
Firmwarealreadythereon
$DEVICE">>$LOGFILE
fi
echo"$(date):
EXITING">>$LOGFILE
exit
fi
sleep1
done
fi
•#############################
.其中
.PRODUCT"="3f0/3b17/100"信息要根据打印机不同做相应修改,
把打印机用usb连接至路由器后,通过putty,利用命令:
Isusb-v|grepID
.获得类似以下信息:
Bus001Device001:
ID1d6b:
0002LinuxFoundation2.0roothub
Bus001Device002:
ID03f0:
3b17Hewlett-PackardLaserJetM1005
MFP
3、设置p910nd,安装了上述的openwrt固件,可略过此步,否则:
vi/etc/config/p910nd编辑加入一下内容:
configp910nd
optiondevice/dev/usb/lp0
optionport0
optionbidirectional1
optionenabled1
4、设置防火墙
vi/etc/config/firewall,在尾部追加一下内容:
#Allowprinter
configrule
optionsrcIan
optionprototcp
optiondest_port9100
optiontargetACCEPT
*最后:
•/etc/init.d/p910ndenable
*reboot
以上就是在openwrt里面的配置,下面是在里面的配置
***********************partI电脑端安装设置以win7系统为例**************************
5、设备和打印机-添加打印机-添加本地打印机-创建新端口(端口类型
Standardtcp/ipport)-IP地址:
路由地址(192.168.5.1)(根据自己路由地址更改),端口名称默认,查询那个钩掉
点下一步就可以添加端口了
6、安装驱动(以HP为例,最后一步会让选择端口,选列表192.168.1.1那个),计算机安装打印机官方驱动。
至此,打印机服务器安装成功,就可以直接打印了。
本文由品质电器生活科技+友情提供赞助
•ClickontheStartbuttonandselectDevicesandPrinters.
•Clickon"Addaprinter."
•IntheAddPrinterdialogselect"Addalocalprinter."
•Select"Createanewport:
"andsetthetypeofportto"StandardTCP/IP
Port".ThenclickNext.
•Inthe"HostnameorIPaddress:
"fieldentertheIPaddressofyourrouter.
•The"Portname:
"fieldmaybesettosomethingyoulike.
•De-select"Querytheprinterandautomaticallyselectthedrivertouse,"thenclicknext.
•ThecomputerwillthenattempttodetecttheTCP/IPport.Thiswilltakesometimeandwillmostlikelyfail.Failingthisstepisnotaproblem.
•Onthe"Additionalportinformationrequired"pagesetthedevicetype
toCustomandclick"Settings…"
•VerifythePrinterNameorIPAddress.TheProtocolshouldbesetto"Raw"andtheRawSettingsPortNumbershouldbe9100.LeaveLPRSettingsandSNMPStatusEnabledemptyorde-selected.ThenclickOK.
•Selectthecorrectprinterdriverandclicknext.Youmayneedtoinstalldriversiftheyarenotalreadyavailable.
•Finishtheremainingprinterinstallationwizardstepsasneeded.The
printershouldnowbeinstalledandworking!
•ClickontheStartbuttonandselectDevicesandPrinters.
•Clickon"Addaprinter."
•IntheAddPrinterdialogselect"Addalocalprinter."
•Select"Createanewport:
"andsetthetypeofportto"StandardTCP/IPPort".ThenclickNext.
•Inthe"HostnameorIPaddress:
"fieldentertheIPaddressofyourrouter.
•The"Portname:
"fieldmaybesettosomethingyoulike.
•De-select"Querytheprinterandautomaticallyselectthedrivertouse,"
thenclicknext.
•ThecomputerwillthenattempttodetecttheTCP/IPport.Thiswilltakesometimeandwillmostlikelyfail.Failingthisstepisnotaproblem.
•Onthe"Additionalportinformationrequired"pagesetthedevicetype
toCustomandclick"Settings…"
・VerifythePrinterNameorIPAddress.TheProtocolshouldbesetto"Raw"andtheRawSettingsPortNumbershouldbe9100.LeaveLPRSettingsandSNMPStatusEnabledemptyorde-selected.ThenclickOK.
•Selectthecorrectprinterdriverandclicknext.Youmayneedtoinstalldriversiftheyarenotalreadyavailable.
•Finishtheremainingprinterinstallationwizardstepsasneeded.The
printershouldnowbeinstalledandworking!
•ClickontheStartbuttonandselectDevicesandPrinters.
•Clickon"Addaprinter."
•IntheAddPrinterdialogselect"Addalocalprinter."
•Select"Createanewport:
"andsetthetypeofportto"StandardTCP/IPPort".ThenclickNext.
•Inthe"HostnameorIPaddress:
"fieldentertheIPaddressofyourrouter.
•The"Portname:
"fieldmaybesettosomethingyoulike.
•De-select"Querytheprinterandautomaticallyselectthedrivertouse,"thenclicknext.
•ThecomputerwillthenattempttodetecttheTCP/IPport.Thiswilltakesometimeandwillmostlikelyfail.Failingthisstepisnotaproblem.
Qnthe"Additionalportinformationrequired"pagesetthedevicetype
toCustomandclick"Settings…"
•VerifythePrinterNameorIPAddress.TheProtocolshouldbesetto"Raw"andtheRawSettingsPortNumbershouldbe9100.LeaveLPRSettingsandSNMPStatusEnabledemptyorde-selected.ThenclickOK.
•Selectthecorrectprinterdriverandclicknext.Youmayneedtoinstalldriversiftheyarenotalreadyavailable.
•Finishtheremainingprinterinstallationwizardstepsasneeded.The
printershouldnowbeinstalledandworking!
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- linux 配置 网络 打印机