树莓派连接网络打印机
1. 安装cupssudo apt-get update
sudo apt-get install cups --fix-missing
若安装遇到问题可以尝试执行:sudo apt-get update --fix-missing
2. 将树莓派默认的用户加入lpadmin组(默认用户名为pi)sudo usermod -a -G lpadmin pi
3. 配置sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak
sudo vi /etc/cups/cusd.conf
# Only listen for connections from the local machine.
Listen 631
Listen /var/run/cups/cups.sock
# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Web interface setting...
WebInterface Yes
# Restrict access to the server...
<Location />
Order allow,deny
Allow from @LOCAL
</Location>
# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow from @LOCAL
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
</Location>
# Restrict access to log files...
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow from @LOCAL
</Location>
红色为修改部分,修改后保存文件。
4. 重启服务sudo service cups start
5. 树莓派安装HP打印机驱动
sudo apt-get install hplip
6.登录后台管理页面,需要用树莓派的用户名和密码
https://10.230.1.205:631
如果在如下图所示的页面有显示打印机,说明可以正确使用了,否则添加一下打印机。
添加打印机
6. 打印测试lp -d HP_LaserJet_Pro_MFP_M226dn__3AACAA_ print.txt