树莓派安装网络共享打印机HP LaserJet CP1025(foo2zjs)

2023-04-01
0评论
/
537阅读
爱搜啊

一、开始动手

    Raspberry Pi 3B+

    系统安装,前期准备+环境配置省略一千字。。

    开启SSH

    更新软件源 (注意现在新的系统最新的是Buster)

设置IP

设置静态IP:

sudo nano /etc/dhcpcd.conf

在文末添加

interface wlan0
#etho 有线网卡名字
#routers是路由器IP domain_name_servers是DNS服务器IP
static ip_address=192.168.0.188/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

修改后重启网络

service network restart

二、正式搭建工作

1、安装惠普hp打印机驱动,此安装会同时安装cups服务,cups服务是我们搭建网络打印机的基础服务。

sudo apt-get install hplip

2、将用户添加入lpadmin,我的用户名是pi。如果不添加,之后添加网络打印机,会报错:Unable to add printer forbidden。

sudo usermod -a -G lpadmin pi

3、修改cups配置环境,为了安全起见,cups服务默认是只能本地用户localhost访问的。现在我们需要远程访问,需要修改配置文件/etc/cups/cupsd.conf。在修改配置文件前,先关掉cups服务

sudo service cups stop                 #关掉服务
sudo gedit /etc/cups/cupsd.conf   #开始编辑 内容如下
sudo service cups start                 #开启服务

4、编辑内容修改为:

# Only listen for connections from the local machine.
#Listen localhost:631
Listen 0.0.0.0:631                             #此行是修改行,并注释上一行
...
# 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
Allow from @Local                             #此行是添加行
</Location>

或者直接在SSH使用命令

# 开启cups远程访问
cupsctl --remote-admin --remote-any --share-printers
# 重启cups服务
sudo service cups restart

如果是其他hp打印机应该就没啥问题了,如果是下面的打印机就需要再多一个步骤

e.g. Minolta magicolor 2200/2300/2430 DL,

HP LaserJet 1018/1020/1022/P2035,

HP LaserJet Pro CP1025nw,

HP LaserJet Pro M12a/M12w,

HP LaserJet Pro P1102/P1102w/P1566/P1606dn

4. 安装 foo2zjs:

a linux printer driver for ZjStream protocol。

# 下载驱动
$ wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz

# 解压驱动
$ tar zxf foo2zjs.tar.gz
$ cd foo2zjs

# 编译
sudo make

# 根据自己打印机型号,下载固件
$ ./getweb cpwl    # Get Minolta Color PageWorks/Pro L .ICM files
$ ./getweb 2200    # Get Minolta 2200 DL .ICM files
$ ./getweb 2300    # Get Minolta 2300 DL .ICM files
$ ./getweb 2430    # Get Minolta 2430 DL .ICM files

$ ./getweb 1000    # Get HP LaserJet 1000 firmware file
$ ./getweb 1005    # Get HP LaserJet 1005 firmware file
$ ./getweb 1018    # Get HP LaserJet 1018 firmware file
$ ./getweb 1020    # Get HP LaserJet 1020 firmware file

$ ./getweb 1025    # Get HP LaserJet Pro CP1025nw .ICM files

#这里以我的CP1025为例
sudo ./getweb 1025

# 编译安装
sudo make install

# 安装热插拔响应
sudo make install-hotplug

# 编译cups
sudo make cups

HP有很多驱动,使用不同协议的打印机有不同的驱动,自己可以去 http://rkkda.com/ 看

5. 如果以上工作没问题,可以通过cups服务添加网络打印机设置了。打开同一局域网下计算机的浏览器,输入树莓派IP:613。例如我的树莓派IP是192.168.0.188,那么输入https://192.168.0.188:631

6 点击Add Print发布打印机,选择Local Printers中的HP CP1025打印机点击Continue。选择Share The Printers,点击Continue,选择HP LaserJet Pro CP1025nw Foomatic/foo2zjs-z3 (recommended) (color) ,注意一定要选择recommended版本的驱动(针对的HP1025)。

树莓派安装共享打印机

7.修改默认配置

因为CP1025是彩色打印机 (默认设置是黑白),点击Printers,选择刚创建的HP CP1025打印机点击如下图位置,选择Set Default Options。

树莓派安装共享打印机

8 添加打印机

windows10直接搜索“添加打印机”;安卓手机的系统打印机能直接搜索到。


本站附件分享,如果附件失效,可以去找找看

诚通网盘附件百度网盘附件


于2023-04-01发布