理论上群辉应该也可以。
: v; H; ]/ c5 O9 p9 X5 f+ G2 `* z* n3 f9 c4 I
我是用PVE的LXC模版。2 K9 d7 {, p* `" i* E; X
PVE版本号:8.4" o7 M/ u- i1 p
LXC是Ubuntu 18.04.3 LTS
! o/ p1 `2 G, Z* x4 P# D$ N, [" }, N因为用这个LXC安装了adguard home,所以也在这个上安装了CUPS,不用折腾换源了。4 D* G" z5 g7 m+ x( v# m @, R! c
每种版本对应的不一样,这个版本的换源是
: E! c4 ]$ u, B5 o9 p打开文档,注释掉原来的源
n2 r- P* V0 S8 f8 @0 S- sudo vi /etc/apt/sources.list
复制代码 阿里云源:* D: Y" K7 H) ?+ k' g' f
- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse( `6 @: {' Y: t/ H+ T' U/ n
- deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse! L- w+ n7 C* X, f
- deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
+ P' G5 J; C _9 C" ? - deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
6 G. g7 Z8 Z$ i p! C& A1 E - deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# V" v* S5 D4 r3 p& z: U9 F - deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
6 z* {- f. d* `3 }0 a! T - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse* U4 O& ?) W* H
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
9 e; Y: k. c8 f' o5 s$ S - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
6 k( o5 ]1 \& H% Z - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 清华源:
1 q! t5 Q8 B# q/ U* g* ]2 _) A- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
6 B @* g' S1 q- b4 X - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
7 M5 L% z6 {( y: U: [4 q - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# f, X Y& r. D - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse5 X9 D7 Z* G. f, r8 o1 o" }
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
9 j+ T1 O3 j9 T* }! l - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse& M7 V9 C6 k; |: Z
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
% I4 |. v+ U# n - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse2 B9 ?$ I. ^: U; E! ]
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
' c% n" |% i2 H7 r - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse6 S1 L, Z1 c5 e
复制代码 中科大源:8 q5 w# z1 ~0 N6 J
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
/ T' R$ @: a& q4 Q7 \2 s) D/ ] - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse5 q v$ ~& _8 r$ K( z, c8 E C1 d
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse2 f8 D+ Y( l, a! ]4 p
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
- l' F& @+ G8 I - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
2 x' m+ k: `, W% L) \- w$ d - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse& N* U" }% ]# U1 d
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse* l+ @& R7 x: f3 X+ m& M' B
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
5 X3 H7 R; w) \8 f! ?5 H ]8 V0 V - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse* r2 x5 j5 m& I- l3 n4 H* \& o
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
复制代码 163源:: ?$ {- f0 V9 D U; U' }
- deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse( Y2 g- h% B' H3 @6 g, H
- deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
6 e" W/ `+ l- A3 w - deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse. S; G4 a* M- V2 C# G
- deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
l7 P: H) t3 C- W) W - deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse* E( |5 n2 Q7 s. u# G
- deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse' s; n1 y5 r! C7 _/ T7 p2 o8 e
- deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse; X: I0 l1 H" F" }4 a( g
- deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
5 v$ x% M9 J* _# p1 | - deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse. X4 n* t0 F9 U0 I, X, x
- deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 更改完成之后执行以下命令
" s6 L( Q* E k3 F: R! z完成后先关闭LXC,打印机插上USB1 r2 O( Y' v x! X
PVE的Shell输入lsusb查询打印机+ {4 P& P9 m H1 q
- root@pve:~# lsusb
; f& L7 v& u" [. v& o5 |8 R9 [ - Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub3 |9 _6 M& B) G( p! B
- 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
) P9 i3 R! J" S+ z2 K - Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
复制代码 Bus 001 Device 003就是打印机,路径是dev/bus/usb/001/003( K( }4 j$ d$ |/ g/ ~9 @1 s6 g
PVE的LXC - 资源 - 添加 - 设备直通 - 粘贴路径 - 确定
& D7 x- H4 ~ ~9 l) _5 _ p) h
& r: h5 R, q) R ]/ {7 m. S1 O启动LXC安装 CUPS 软件及打印机驱动
( F% r6 w0 E4 @. a4 o- apt install cups hplip -y: k' b4 I w- z2 R4 G6 q
- systemctl enable cups( Z: @+ J+ j- s1 G4 n: a
- systemctl start cups
复制代码 编辑 CUPS 的配置文件
N. ]* M1 k# N+ C% w6 a- nano /etc/cups/cupsd.conf
复制代码 其他项按照以下修改% q' i- b8 w2 K7 m$ I
+ p/ u l& @1 |- }% \) w- ]
- # Restrict access to the server...! d& r& z' A v/ S: T1 t8 g8 ?
- <Location /> \3 ] k' F' w6 C) }
- Order allow,deny
: m: }- p3 ~( L2 Y9 R. x" J2 G - Allow all
: P( K0 U0 Q+ @, P) C - </Location>
( G ?) S A6 j" B4 b9 H% x5 [. c: p
' v; m8 r+ c8 J+ S/ |7 ]2 Y; X- # Restrict access to the admin pages...! ?3 E0 B; i( X/ e q ]8 ^
- <Location /admin>
& q! d- H3 u6 K' @, T - Order allow,deny' R* h0 |- r( h x/ c/ F. R( V* A
- Allow all9 ]$ Q4 j4 N- j2 f- m4 p
- </Location>
. ]7 C( U6 H4 m; O% K/ }' | - 7 [9 d2 f$ ?. v& X5 x% z
- # Restrict access to configuration files...9 i8 @& Q% g" `2 G
- <Location /admin/conf>3 h' f# _' S0 R f, f! Q
- AuthType Default. u* {, r3 ? n D( d# |
- Require user @SYSTEM
' y8 w* d6 K! G. {! f; j9 I. _ - Order allow,deny
% w5 q1 w1 l2 P5 i7 Z& [4 ^9 ] - Allow all
+ }! L0 M, r& H0 ?# t; s/ e( k* G3 X# p - </Location>
8 a! W# p* c# h" [, U8 {0 p - ( o1 ?" H, g4 U6 H f3 W
- # Restrict access to log files...
# Q. ~% b9 J6 |: f - <Location /admin/log>9 i+ k0 ^' B+ D. s0 e
- AuthType Default
8 E5 ~, ^, s4 ^$ M; m3 L8 t - Require user @SYSTEM
8 a0 Z( z) r0 r8 H" F$ W% s - Order allow,deny6 o" t3 {2 }5 k4 W2 h) z
- Allow all
" k" K, Y7 O: G3 \2 R5 W - </Location>
复制代码 修改好后Ctrl+S 保存、Ctrl+X 退出,重启CUPS
5 v X0 S' S1 r5 F' Z- v2 y8 D- sudo service cups restart
复制代码 下载惠普HP136a LINUX驱动- L5 o. I8 T; i2 J% J, z+ T
- wget https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 解压
' V! @0 g: h) v- tar -zxvf uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 进入安装目录
) z& W9 _6 e+ J# {* P, z1 c给个权限
$ d9 ]6 R0 j; C# r& v- V( ]4 H, Y# d" b3 P8 f3 \, Q
安装驱动
, J$ ]: e1 g3 \5 ?一大段说明,慢慢按回车键,Y同意就行。4 w9 H! d# {% g+ |- s! y; U
安装好后打开CUPS界面,账号root,密码就是lxc设置的密码; \& m" m4 j7 x- s
添加打印机就行,驱动选择HP Laser MFP 13x Series
) O/ f" J" A& X) N3 m$ aCtrl+F搜索“13”容易找到。
0 T4 o. ^" S; I, Y5 w S& x设置好后,手机也可以打印了,不用下载APP
1 m H8 r) `, R/ v% G电脑添加打印机是(举个例子)! N) k+ @0 _5 G
- https://192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机添加打印机是(举个例子),不带http的1 U1 q" t* _# k3 O
- 192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机相册里可以直接打印了。 |