利用树莓派建立打印共享服务器

利用树莓派建立打印共享服务器

https://zhuanlan.zhihu.com/p/496961274

安装插件

https://developers.hp.com/hp-linux-imaging-and-printing/plugins

Plugins

hplip-3.17.11-plugin.run

hplip-3.17.11-plugin.run.asc

hplip-3.18.3-plugin.run

hplip-3.18.3-plugin.run.asc

hplip-3.18.4-plugin.run

hplip-3.18.4-plugin.run.asc

hplip-3.18.5-plugin.run

hplip-3.18.5-plugin.run.asc

hplip-3.18.6-plugin.run

hplip-3.18.6-plugin.run.asc

hplip-3.18.7-plugin.run

hplip-3.18.7-plugin.run.asc

hplip-3.18.9-plugin.run

hplip-3.18.9-plugin.run.asc

hplip-3.18.10-plugin.run

hplip-3.18.10-plugin.run.asc

hplip-3.18.12-plugin.run

hplip-3.18.12-plugin.run.asc

hplip-3.19.1-plugin.run

hplip-3.19.1-plugin.run.asc

hplip-3.19.3-plugin.run

hplip-3.19.3-plugin.run.asc

hplip-3.19.5-plugin.run

hplip-3.19.5-plugin.run.asc

hplip-3.19.6-plugin.run

hplip-3.19.6-plugin.run.asc

hplip-3.19.8-plugin.run

hplip-3.19.8-plugin.run.asc

hplip-3.19.10-plugin.run

hplip-3.19.10-plugin.run.asc

hplip-3.19.11-plugin.run

hplip-3.19.11-plugin.run.asc

hplip-3.19.12-plugin.run

hplip-3.19.12-plugin.run.asc

hplip-3.20.3-plugin.run

hplip-3.20.3-plugin.run.asc

hplip-3.20.5-plugin.run

hplip-3.20.5-plugin.run.asc

hplip-3.20.6-plugin.run

hplip-3.20.6-plugin.run.asc

hplip-3.20.9-plugin.run

hplip-3.20.9-plugin.run.asc

hplip-3.20.11-plugin.run

hplip-3.20.11-plugin.run.asc

hplip-3.21.2-plugin.run

hplip-3.21.2-plugin.run.asc

hplip-3.21.4-plugin.run

hplip-3.21.4-plugin.run.asc

hplip-3.21.6-plugin.run

hplip-3.21.6-plugin.run.asc

hplip-3.21.8-plugin.run

hplip-3.21.8-plugin.run.asc

hplip-3.21.10-plugin.run

hplip-3.21.10-plugin.run.asc

hplip-3.21.12-plugin.run

hplip-3.21.12-plugin.run.asc

hplip-3.22.2-plugin.run

hplip-3.22.2-plugin.run.asc

hplip-3.22.4-plugin.run

hplip-3.22.4-plugin.run.asc

hplip-3.22.6-plugin.run

hplip-3.22.6-plugin.run.asc

安装驱动及打印程序
首先更新源并安装Hp的打印机驱动 hplip
$ sudo apt update
$ sudo apt install hplip

然后安装Apple开源的远程打印工具 cups,并配置相应权限
$ sudo apt install cups # Install cups package
$ sudo usermod -aG lpadmin pi # Add user to lpadmin group,pi is your user name
$ sudo cupsctl --remote-any # open remote access

然后使用在同一局域网的电脑,访问 https://树莓派IP:631

连接打印机和树莓派,点击Add Printer添加打印机,在弹出的窗口中输入对应的用户信息,使用在上一步中用户组中添加的用户

然后按着一步步的指引,选择HP LaserJet 1020打印机,然后按照提示,选择和名称对应的驱动,我们会发现 LaserJet 1020 对应驱动会提示:HP laserjet requires proprietary plugin,也就是我们不仅需要这个通用的驱动,而且需要一些额外的插件,打印机才能正常工作。

查阅资料发现:HP官方已经给出了说明,我们需要查看hplip版本,然后安装对应的驱动插件。

首先我们查看一下版本,发现是3.20.3版本
$ sudo apt show hplip
Package: hplip
Version: 3.20.3+dfsg0-2
Priority: optional
Section: utils
Origin: Ubuntu
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: Debian Printing Team debian-printing@lists.debian.org
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 518 kB

然后在 插件列表 中找到 3.20.3 对应的hplip-3.20.3-plugin.run和hplip-3.20.3-plugin.run.asc,使用wget下载到树莓派本地。
Package: hplip
Version: 3.17.10+repack0-5
Priority: optional
Section: utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Printing Team <debian-printing@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,595 kB
Depends: adduser, cups, hplip-data (= 3.17.10+repack0-5), libhpmud0 (= 3.17.10+repack0-5), libsane-hpaio (= 3.17.10+repack0-5), lsb-base, printer-driver-hpcups (= 3.17.10+repack0-5), python3-dbus, python3-gi, python3-pexpect, python3-pil, python3-reportlab, wget, python3 (<< 3.7), xz-utils, python3 (>= 3.6~), libc6 (>= 2.17), libcups2 (>= 1.6.0), libdbus-1-3 (>= 1.9.14), libsane1 (>= 1.0.24)
Recommends: avahi-daemon, policykit-1, printer-driver-postscript-hp, sane-utils
Suggests: hplip-doc, hplip-gui, python3-notify2, system-config-printer
Homepage: https://developers.hp.com/hp-linux-imaging-and-printing
Task: ubuntu-desktop, kubuntu-desktop, xubuntu-core, xubuntu-desktop, lubuntu-desktop-share, lubuntu-gtk-desktop, lubuntu-desktop, lubuntu-qt-desktop, ubuntustudio-desktop-core, ubuntustudio-desktop, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop
Supported: 5y
Download-Size: 1,030 kB
APT-Manual-Installed: yes
APT-Sources: http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports bionic/main arm64 Packages
Description: HP Linux Printing and Imaging System (HPLIP)

运行 hp-setup -i 使用命令行进行安装,按照提示命令,进行插件的安装。

[scode type=“yellow”]这里建议提前下好安装,而不是直接联网下载,速度较快,指定路径需要为绝对路径[/scode]

至此,我们可以尝试使用手机或者电脑搜索打印机来进行打印测试,没有其他意外的话,可以发现打印成功!

另一种办法

raspberry 4安装HP 1020 plus打印机,利用树莓派4制作无线打印服务器