手里有几台 这样的打印机正常要用起来的插到电脑连接然后其他人要用得共享,最起码也要开着台电脑给它才行,但又不是天天打印开着又浪费电,所以才有了用个其他设备把它连接到网络去。用开发板又属实浪费,刚好之前挖矿剩下一堆 老母鸡 玩客云可以派上用场,配置 1+8G armv7的S805。机器 就算常年通电也用不了多少电,刷上 armbian系统, 开始选用比较强大的cups,物理机直接装也行,自己配置一下,但是对于新手也是有些麻烦。。。 刚好 docker还有一个还有人维护的cups docker镜像,, 而且还贴心的支持 armv7 arm64 amd64 基本全了。。。。
官方的方法
ydkn/cups
CUPS Docker Image
https://gitlab.com/ydkn/docker-cups
Architectures
amd64
arm32v7
arm64v8
Usage
Start the container
docker run -d --restart always -p 631:631 -v $(pwd):/etc/cups ydkn/cups:latest 把pwd 替换成你宿主机的目录 映射那个cups的配置文件文件夹的
Configuration
Login in to CUPS web interface on port 631 (e.g. https://localhost:631) and configure CUPS to your needs. Default credentials: admin / admin
To change the admin password set the environment variable ADMIN_PASSWORD to your password.
docker run -d --restart always -p 631:631 -v $(pwd):/etc/cups -e ADMIN_PASSWORD=Abc123 ydkn/cups:latest 这个就是上面的增加了一个自定义的密码Abc123而已 不然要用root的密码 pwd更换这部分更换成宿主目录可以自定义一个目录。。
上面是官方直接复制过来的。。。 需要一点点docker基础 替换几处自己的本地目录和设置密码。。
有些设备直接用可能web里面看不到打印机。。。 我下面又改了一下 给他最高权限获取usb 设备信息。。 只要关机或插拔它自带会识别到打印机,对于我这个老设备打印机刚好。
下面我简单修改一下
部署按照
Docker部署,Podman部署都行
部署cups 获取USB最大权限
docker run -d \
--name=cups \
--restart always \
--privileged \
-p 631:631 \
-v /root/cups:/etc/cups \
-v /dev/bus/usb:/dev/bus/usb \
-e ADMIN_PASSWORD=Abc123 \
ydkn/cups:latest
按这方式,需要在 建立/root/cups 这个目录 或直接 mkdir -p /root/cups
usb://HP/LaserJet%201020?serial=S42AXGR|HP LaserJet 1020
这是我打印机的信息和序列好 你们添加的话应该有对应的,
添加了后 顺便把这个玩客云加入到组网去。。。我这边用了 tailscale组网,不组本地局域可以用了。。。
组了主要在外面或 直接手机 往打印机发 懒得开电脑。。
此docker镜像已经基本全能了把 我的老古董都能直接使用了 其他测试
顺便贴上
cupsd.conf的配置
LogLevel warn
PageLogFormat
MaxLogSize 0
# Allow remote access
Port 631
Listen 0.0.0.0:631
Listen [::]:631
Listen /run/cups/cups.sock
# Share local printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
BrowseOrder allow,deny
BrowseAddress @LOCAL
# Allow all local networks to access printers
DefaultAuthType Basic
WebInterface Yes
<Location />
# Allow shared printing and remote administration...
Order allow,deny
Allow all
</Location>
<Location /admin>
# Allow remote administration...
Order allow,deny
Allow all
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
# Allow remote access to the configuration files...
Order allow,deny
Allow all
</Location>
<Location /admin/log>
AuthType Default
Require user @SYSTEM
Order allow,deny
# Allow remote access to the log files...
Order allow,deny
Allow all
</Location>
<Policy default>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy kerberos>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Negotiate
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job>
AuthType Negotiate
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Negotiate
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
ServerAlias *