树莓派3配置局域网打印服务器惠普打印机HP1108

使用树莓派配置打印机服务器最常用的就是CUPS,这里就用CUPS来配置

首先使用ssh登录树莓派

1.更新

sudo apt-get update
2.安装HPLIP

sudo apt-get install hplip
3.安装CUPS

sudo apt-get install cups

安装HPLIP时,CUPS已经安装上了,这里安装时会看到已经安装过的提示。

4.将树莓派默认用户pi添加到用户组lpadmin里

sudo usermod -a -G lpadmin pi
5.配置cupsd.conf

先备份cupsd.conf

sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak
cupsd.conf默认的配置文件只能本地访问,所以需要修改一些内容使局域网的电脑访问

配置不成功时,访问http://树莓派ip:634/会出现forbidden的界面

首先需要将

Listen localhost:631
改成
Listen 0.0.0.0:631

将<Location /> <Location /admin> <Location /admin/conf>三个节点添加

Allow from @LOCAL
可能有的教程给的配置是Allow @Local,这是旧版的兼容写法,在 CUPS官网ARCH LINUX的教程中给出都有from

此时再重启CUPS服务即可生效

sudo service cups restart
笔者的校园网环境有些特殊,是跨网段的局域网。

所以在<Location /> <Location /admin> <Location /admin/conf>三个节点再添加一句

Allow from 172.*
这些节点可以添加网段的方法如下

<Location /path>
  ...
  Allow from All
  Allow from None
  Allow from *.domain.com
  Allow from .domain.com
  Allow from host.domain.com
  Allow from nnn.*
  Allow from nnn.nnn.*
  Allow from nnn.nnn.nnn.*
  Allow from nnn.nnn.nnn.nnn
  Allow from nnn.nnn.nnn.nnn/mm
  Allow from nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
  Allow from [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]
  Allow from [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]/mmm
  Allow from @LOCAL
  Allow from @IF(name)
</Location>
再次重启服务,使之生效

sudo service cups restart
6.打开网页配置打印机共享

连接打印机和树莓派

输入 https://你的树莓派ip:631 进入配置界面

Administrator-->Add Printer-->输入树莓派的用户名密码pi/raspberry

显示的Local Printers会有你连接上的那台打印机,应该是带有USBxxx之类的,选中它点击continue
在这个界面Name是打印机的名字,以后用来在URL中确定打印机,所以短一些比较好
勾选Sharing,别的不用变,点Continue
下一个界面选择驱动程序,这边的时候记得选择recommended的那个驱动,如果自己有ppd,可以上传打印驱动程序
最后就设置完成了,复制最后一个界面的URL,也就是类似于http://你的树莓派ip:631/printers/打印机名 就可以在其他电脑上添加共享打印机了

在Printer页面可以复制打印机对应的超链接,超链接可能为HTTPS格式,如:https://192.168.199.132:631/printers/HP_LaserJet_Professional_P1108

在电脑上添加打印机要将https改成http即

http://192.168.199.132:631/printers/HP_LaserJet_Professional_P1108

7.windows打印机配置

打开任意文档,文件-->打印,点击查找打印机,在打印机(P)地址栏输入:http://192.168.199.132:631/printers/HP_LaserJet_Professional_P1108

系统检测到打印机后,会提示安装该网络打印机驱动。如果电脑安装过打印机驱动,直接点击浏览,找到驱动目录的autorun.inf,然后选择打印机型号1108,之后就可以打印了。以后打印机就不用再安装驱动就可以直接打印了。


附:故障处理

1.打印机出现卡纸故障后,无法再使用网络打印

解决方法:检查CUPS后台Printer选项之后,打印机状态停留在Pause(暂停)状态,无论如何重启打印机和树莓派,始终是Pause状态;查看Jobs选项,后面还有很多发送到CUPS的任务,但任何打印任务都无法往下执行。打印机直连电脑却可以打印。笔者尝试在CUPS删除该打印机然后再重新添加,状态变成了Idle(空闲),打印机恢复正常,能正常打印了。

2.打印机状态出现暂停

在windows上打印列表里出现已暂停的提示,这时需要先清空打印任务,具体方法如下:1.进入CUPS维护界面:进入CUPS后台页面-->Printer-->点击打印机名。2.在维护界面移除所有打印任务:第一个下拉菜单中选择Move All Jobs,3.在维护界面重新调整打印机状态:重新进入维护页面,选择第三项Pause printer/Resume Printer,反复几次,最终使打印机后台的状态变成Idle(空闲),或者Idle - "ready to print"(空闲-"等待打印")

资源分为10份,此为第9份文件,包含以下打印机PPD文件: hp-officejet hp-officejet_r80xi hp-officejet_series_300 hp-officejet_series_310 hp-officejet_series_320 hp-officejet_series_330 hp-officejet_series_350 hp-officejet_series_520 hp-officejet_series_570 hp-officejet_series_580 hp-officejet_series_590 hp-officejet_series_600 hp-officejet_series_610 hp-officejet_series_630 hp-officejet_series_700 hp-officejet_series_710 hp-officejet_series_720 hp-officejet_series_725 hp-officejet_t_series hp-officejet_v30 hp-officejet_v40 hp-officejet_v40xi hp-officejet_v45 hp-photosmart_100 hp-photosmart_1115 hp-photosmart_1215 hp-photosmart_1218 hp-photosmart_130 hp-photosmart_1315 hp-photosmart_140_series hp-photosmart_230 hp-photosmart_240_series hp-photosmart_2570_series hp-photosmart_2600_series hp-photosmart_2700_series hp-photosmart_3100_series hp-photosmart_3200_series hp-photosmart_320_series hp-photosmart_3300_series hp-photosmart_330_series hp-photosmart_370_series hp-photosmart_380_series hp-photosmart_420_series hp-photosmart_470_series hp-photosmart_5510_series hp-photosmart_5510d_series hp-photosmart_5520_series hp-photosmart_6510_series hp-photosmart_6520_series hp-photosmart_7200_series hp-photosmart_7345 hp-photosmart_7400_series hp-photosmart_7510_series hp-photosmart_7520_series hp-photosmart_7550 hp-photosmart_7600_series hp-photosmart_7700_series hp-photosmart_7800_series hp-photosmart_7900_series hp-photosmart_8000_series hp-photosmart_8100_series hp-photosmart_8200_series hp-photosmart_8400_series hp-photosmart_8700_series hp-photosmart_a310_series hp-photosmart_a320_series hp-photosmart_a430_series hp-photosmart_a440_series hp-photosmart_a510_series hp-photosmart_a520_series hp-photosmart_a530_series hp-photosmart_a610_series hp-photosmart_a620_series hp-photosmart_a630_series hp-photosmart_a640_series hp-photosmart_a710_series hp-photosmart_a820_series hp-photosmart_b010_series hp-photosmart_b109a_series hp-photosmart_b110_series
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值