找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 532|回复: 6

PVE安装CUPS打印机服务器,解决惠普136A打印机驱动

[复制链接]
发表于 2025-4-19 22:27:36 | 显示全部楼层 |阅读模式
理论上群辉应该也可以。
2 I) q; |+ P( M7 Q1 u: L
: ?! O8 M# t- O3 w# X我是用PVE的LXC模版。
( q# e+ y" Q5 q/ GPVE版本号:8.41 p7 Z: I$ h' a$ d
LXC是Ubuntu 18.04.3 LTS" O! t( M6 U7 L8 q3 k8 `
因为用这个LXC安装了adguard home,所以也在这个上安装了CUPS,不用折腾换源了。
# E  `: G6 l/ B1 v: @  {7 y4 f/ Z( f每种版本对应的不一样,这个版本的换源是
& C1 D- ^! q% t! M- A# L) v打开文档,注释掉原来的源
. y$ ~: [3 V, Q9 A
  1. sudo vi /etc/apt/sources.list
复制代码
阿里云源:
+ R6 I, A! P8 Y8 Y0 E
  1. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse7 R  r0 R- x% l! w! L# y
  2. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    : ?/ \& ]7 M/ V, u0 f% q$ u
  3. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse; A- Y0 \$ c- f/ J
  4. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    $ n8 ]) Z; d6 @& u
  5. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    6 \) W- _$ e5 ?
  6. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    5 r' n- V/ y% j0 c& @9 _  P
  7. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse, X9 y3 p/ b9 X7 l6 @0 B; C7 Y( q: V
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse4 w& L  }6 d4 Q% f3 n# [; x$ `) ^7 V* S
  9. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
      Q) J! D" Q  ~
  10. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码
清华源:1 Y& ?( f4 M7 s# ]
  1. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
    $ E$ @: \/ s  H/ J
  2. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    2 `5 Y/ V+ K: v; r7 A! {8 g* d
  3. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse7 d( D' ?: }: d
  4. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    5 A) a. e4 _. n' K3 F' k! X' {' E
  5. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse" n+ U6 @3 F& F
  6. deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse. b8 X6 k4 r7 M" q+ a4 O
  7. deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    $ e7 L# N. |/ w
  8. deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    , X% J3 b6 M- _) [0 Q
  9. deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    4 A/ n  L4 Y* L
  10. deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse# C- B! J' T6 H) A" y
复制代码
中科大源:
4 \" R7 p+ I: U; A/ u8 y6 ^) K
  1. deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse1 l& l& C0 s4 I! I& D/ s' i
  2. deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse: @* [* t/ [6 h/ k
  3. deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    9 z  c/ p! T3 L
  4. deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    : D9 h: q' ~  W) C% ]" O
  5. deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse2 i+ ^% ^8 d3 l5 u$ G
  6. deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    - R& B: B# I. \; Q( g6 J
  7. deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse; ]. g7 @' p7 B" L" o, [
  8. deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse/ J# N* _0 n+ ]  P7 ~) C
  9. deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    3 ]$ `4 _( e# E+ y" G
  10. deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
复制代码
163源:
; @" a: U% o. a; ]) @- ^3 b
  1. deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse3 t( J" @/ e# j' }
  2. deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
    0 N2 b. j: g4 {) N, B
  3. deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse5 f5 c) `. \, |$ N1 v; m
  4. deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
    6 a: R( _& @- q9 |1 L* F$ ]
  5. deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse$ T+ w' s0 b( c8 ^$ {  S" A
  6. deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse( S  u+ V! f  J  l
  7. deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse- y& Q# i# I$ @) n- y, Z. P- t
  8. deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
    * F1 y7 W1 n/ H) v6 A: x
  9. deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
    / k6 |! H7 D$ I* w5 I2 F' H/ ^
  10. deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码
更改完成之后执行以下命令) U7 I1 {) e$ j
  1. sudo apt-get update
复制代码
完成后先关闭LXC,打印机插上USB) a% E) n9 j0 S  U4 C
PVE的Shell输入lsusb查询打印机) ~& W: k) b' _  y' q) H# ~* s# q) _
  1. root@pve:~# lsusb+ E) n3 a/ i6 Q' N0 `9 S# r
  2. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    7 W  ?# a# Q- p  h; l' I
  3. Bus <font color="#ff0000">001</font> Device <font color="#ff0000">003</font>: ID 03f0:f22a <font color="#ff0000">HP</font>, Inc HP Laser MFP 136a) M4 @7 D  p7 F
  4. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
复制代码
Bus 001 Device 003就是打印机,路径是dev/bus/usb/001/003
  L. H1 h0 o, S! }$ I- \9 ePVE的LXC - 资源 - 添加 - 设备直通 - 粘贴路径 - 确定& W9 e! W! c5 N- \; F6 A! f% T" f

2 p* ], q: r. F; _  T+ `- f启动LXC安装 CUPS 软件及打印机驱动6 C% d, s1 L: V/ T
  1. apt install cups hplip -y
    - w8 E3 v, o) L& `& f
  2. systemctl enable cups6 D5 V0 k" ?( P1 M( w- A
  3. systemctl start cups
复制代码
编辑 CUPS 的配置文件
- j! t$ p' n- `( Q6 z2 k
  1. nano /etc/cups/cupsd.conf
复制代码
其他项按照以下修改. p1 I# H& F3 p4 I  v% ?: [# F
1 p, [# F+ \3 J9 t
  1. # Restrict access to the server...  T1 H( g2 \( G" l: M+ T6 ^- g
  2. <Location />
    7 a- [1 B& R" [3 t
  3.   Order allow,deny
    & t, ]# j$ Z8 f% Y8 U: E
  4.   Allow all) Y4 k$ c4 F+ A1 j( T
  5. </Location>* F; t7 _8 `" N% [9 K& l/ F& M9 O

  6. ; _* G1 M  M# N) A# l
  7. # Restrict access to the admin pages...
    / @2 ^. X7 c: I$ b5 E6 ]0 R' }) w
  8. <Location /admin>
    7 N2 I& j/ W) y7 G3 t/ O9 O
  9.   Order allow,deny1 d: V7 g4 ?# g
  10.   Allow all
    6 \" U5 @; Z6 I. ~
  11. </Location>+ C/ M, W& O& j' b1 F4 f" D
  12. % ~$ N1 ?( I4 m# K# L
  13. # Restrict access to configuration files.../ |* |5 N) M$ ?
  14. <Location /admin/conf>
    3 @0 Z; D9 l8 ?; P, B0 o
  15.   AuthType Default, l; n- n1 \  Q2 Y' T7 e" g" T
  16.   Require user @SYSTEM
    7 A3 E" ~" i+ u+ Q
  17.   Order allow,deny
    ( @* G3 c. T7 h, D
  18.   Allow all
    ; P& N. V6 d1 k0 X4 c0 k8 q
  19. </Location>
    3 R3 u& `) h/ ?+ h3 V' `$ F

  20. & `8 G& @: o) n9 @2 l
  21. # Restrict access to log files...
    ( s4 g! u( l' B) e; [
  22. <Location /admin/log>" y* z; Z2 I& F( J
  23.   AuthType Default" v: x) F- }; z% N2 X
  24.   Require user @SYSTEM& R. Z; G2 B# A
  25.   Order allow,deny0 T( E4 T4 n, P
  26.   Allow all3 i6 ]2 }( S8 W" V; {+ a
  27. </Location>
复制代码
修改好后Ctrl+S 保存、Ctrl+X 退出,重启CUPS
# a( X  X+ r1 ]" w
  1. sudo service cups restart
复制代码
下载惠普HP136a LINUX驱动
! W' X% ]4 ^: D  J. m/ |
  1. wget https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz
复制代码
解压
+ |7 ^  d7 \/ A3 i9 w
  1. tar -zxvf uld-hp_V1.00.39.12_00.15.tar.gz
复制代码
进入安装目录
: S1 X" M( o+ E# i; e: B# T
  1. cd uld
复制代码
给个权限/ y  ~  Q' L, w% k+ r4 q9 z1 q
  1. chmod +x install.sh
复制代码
& z3 b8 Y& Y8 k$ z( Q) Y& ]
安装驱动% [6 P, x# ?- P3 H4 Z9 [% k2 u
  1. ./install.sh
复制代码
一大段说明,慢慢按回车键,Y同意就行。0 D) ~  H( Y' d# }8 ?/ Z7 c& Q
安装好后打开CUPS界面,账号root,密码就是lxc设置的密码
" K6 y( D$ X7 r4 N5 `. }5 H添加打印机就行,驱动选择HP Laser MFP 13x Series) d0 \" r) c3 H& V7 {
Ctrl+F搜索“13”容易找到。3 b/ m4 _" Z; o2 {: ~) u, o- _7 Y
设置好后,手机也可以打印了,不用下载APP
% C$ n, P! H2 E! x- l电脑添加打印机是(举个例子)+ x/ C4 b3 t! e3 x6 ~+ B* Q" Q( F
  1. https://192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码
手机添加打印机是(举个例子),不带http的
. G0 H5 F. l0 U* c
  1. 192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码
手机相册里可以直接打印了。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2025-4-20 09:24:14 | 显示全部楼层
不错,谢谢分享
发表于 2025-4-20 11:28:36 | 显示全部楼层
装OpenWrt/DD-WRT这些轻量级的固件不香么?) N& Q  `% u( C( i

/ D; f* ^: z" }8 B6 T7 ?
2 E  U+ V5 `9 }' {5 l3 ?' E! m5 r二○二五年四月二十日
 楼主| 发表于 2025-4-20 16:56:43 | 显示全部楼层
邪恶海盗 发表于 2025-4-20 11:28
9 a/ `6 S. u$ K2 p; n装OpenWrt/DD-WRT这些轻量级的固件不香么?
; n: N3 @4 Q2 H$ Z( M: t; Y( X, ?# ^
装过。旁路由经常不用,adguard是常开机,所以和adguard装一块了。
发表于 2025-5-27 09:55:48 | 显示全部楼层
不错,谢谢分享
发表于 2025-5-27 20:33:09 | 显示全部楼层
不错,谢谢分享
 楼主| 发表于 2025-5-29 06:50:45 | 显示全部楼层
2025/5/29更新,还是有些不好用,海鲜市场入手了小白盒,好几天没和媳妇吵架了。。。。
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-10-23 07:35 , Processed in 0.021922 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表