理论上群辉应该也可以。
2 C4 I# X4 T! v4 G6 h2 I/ f# B3 s5 Z3 d" R& y# {9 k' B
我是用PVE的LXC模版。8 s# z/ ?" `/ {' `! N2 E( c
PVE版本号:8.4
* c1 p) F3 e& s% a' p" C. Q6 s$ TLXC是Ubuntu 18.04.3 LTS+ s1 T# ? Q7 @% y- p
因为用这个LXC安装了adguard home,所以也在这个上安装了CUPS,不用折腾换源了。! q# n- f% e: T
每种版本对应的不一样,这个版本的换源是
6 j5 N! Y3 q/ T) o0 V% S打开文档,注释掉原来的源5 P/ S N: Z; ]" a; Z0 ?
- sudo vi /etc/apt/sources.list
复制代码 阿里云源:
) s, @5 R- H! r! g% z- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
; \) S: P1 o0 x2 {& J - deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
0 x1 s7 a3 h- \ - deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
% c5 a, E$ j" U R$ O; j - deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" {+ G V! `, U5 W' U% u; ~
- deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
) f! c5 d# e8 U! F$ g - deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
- S+ M0 }% T7 V' J/ u - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" n! d9 b+ _3 l5 r. ~
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse) X5 ]" I- S$ J; E4 I
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse# j2 J/ y. W' p# X# G
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 清华源:8 t, |' |, C7 u, p* ^5 m
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse) |% c# m$ @- T
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse# d0 e/ b9 b' r& y5 j* Q6 C, j
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
1 W- d* N& `: |2 K3 y - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
( U& I! E- N$ i5 j- M6 |& ` - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
{0 x7 P6 h5 m4 O6 K5 J. S - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
; c p# g: B8 j* e - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
, N8 G2 P' T3 M8 j8 a - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
/ c& E- A8 a( A3 \+ I - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
, m2 O: l: m/ y7 l - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse9 A4 ^ u/ A$ b# m
复制代码 中科大源:+ ~1 K- o1 E' t* L$ ~" G
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
) M9 d' i7 r# k$ J2 A; | - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
9 A- Z2 w& X1 K7 [1 x" O - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
9 r5 ]4 q5 O* A5 l; v - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse- \5 D E& l2 |, s3 O' N
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse5 h: t# B- H. C- t% r
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse5 x& o5 A Q& _( U5 Z/ c. Y8 L
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse h6 Y8 P9 ] B$ F
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse$ V2 ]1 ?! z& g: S. P) L
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse$ M- T0 ~ T& t; h5 S
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
复制代码 163源:
4 P" ]4 A, V. V" g7 G6 Y+ ?, q0 \- deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse3 a& _% w& k$ Y% v
- deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
- D$ [3 F7 c& R+ Y3 p0 L - deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
7 C7 T9 `! B( E' A" B7 E4 q - deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
0 t& x4 O- |- ]$ b - deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
0 C9 ~. i: l* `4 v - deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse, A$ H% \# j; J5 R
- deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse2 A4 J# b$ G& o) i' J. G& m! f
- deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
2 z5 ]- P6 z E3 f' o) p- w6 O) C) A - deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
/ z- G9 G6 d3 v. ^ - deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 更改完成之后执行以下命令& h# y" F' D# h; K
完成后先关闭LXC,打印机插上USB
# h% A/ D1 j' _5 D1 \ s+ H$ `PVE的Shell输入lsusb查询打印机6 W! ~8 B! O! u; O# ^+ _9 h, Y
- root@pve:~# lsusb
+ r9 O4 h2 @ f: r) q5 a( ^3 T - Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub$ }: C# k8 l$ N0 @6 |+ O) i
- Bus <font color="#ff0000">001</font> Device <font color="#ff0000">003</font>: ID 03f0:f22a <font color="#ff0000">HP</font>, Inc HP Laser MFP 136a2 J, h; U; U; L! d* R
- Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
复制代码 Bus 001 Device 003就是打印机,路径是dev/bus/usb/001/003
) a0 c& n- }! j. S1 J0 j7 r3 o% [PVE的LXC - 资源 - 添加 - 设备直通 - 粘贴路径 - 确定
- e/ D9 S+ p! g9 R
9 j* _5 t5 s: f- i% G! g) P启动LXC安装 CUPS 软件及打印机驱动
" F" v/ H+ T9 P- apt install cups hplip -y* g- b3 ?0 L) y6 G
- systemctl enable cups! B9 V$ o1 F# F' Z5 B0 W
- systemctl start cups
复制代码 编辑 CUPS 的配置文件
1 s4 _0 Y- ?! X- |- nano /etc/cups/cupsd.conf
复制代码 其他项按照以下修改* I5 }1 h) ^! }
# [9 w3 ]: \! H0 O- # Restrict access to the server...' j7 N4 d# C4 j3 c3 N, W5 s/ l
- <Location />
# p# }) H6 {& A) P - Order allow,deny. [ }( y ?; A: H/ u) \( ]
- Allow all% T- O! s; s, X/ J! M* p+ D
- </Location>. E- ]% H% v2 a- ]% K* b+ n
- ' \( \+ d" b7 O' c
- # Restrict access to the admin pages...
2 h5 B" o* Q% `+ x) \ - <Location /admin>
( {# I# k# Y( a1 Y4 D+ f/ m; e - Order allow,deny
2 K; h8 m/ o R/ u0 Z2 u; u& |) E3 Z - Allow all
! r9 A* K/ X) S, Q - </Location># i# l& }; D4 X
- 8 s, u4 a5 U2 C: U
- # Restrict access to configuration files...* x- ~. j0 ]( B5 M) z" G- e
- <Location /admin/conf> r) k5 h* X; w- @
- AuthType Default0 U; Q7 K; s4 E, l1 R4 ~
- Require user @SYSTEM
2 B) b+ ~9 l' r- [$ @ - Order allow,deny
5 K) ]9 r& R3 L4 Z, \1 h - Allow all0 i D2 j# J+ g) h- ~) g
- </Location>! X7 K4 H2 X+ S& Z4 [
- 5 }& _- }- V9 O' j. R/ Q# g1 i
- # Restrict access to log files...$ d3 m0 i% T0 I4 B( Z R
- <Location /admin/log>) w7 Q! Y' h l4 T L, c/ E
- AuthType Default
9 I3 h3 h3 r2 g: p. t* F' v9 u - Require user @SYSTEM) q* s s- b+ O1 V
- Order allow,deny
6 S2 F5 d3 \6 v0 b- u! I' e. P - Allow all% u. L. b/ a- s# ]- F0 V$ F( p
- </Location>
复制代码 修改好后Ctrl+S 保存、Ctrl+X 退出,重启CUPS
0 O" e& q- X, W; C! O! ]6 C9 ?- sudo service cups restart
复制代码 下载惠普HP136a LINUX驱动
1 F5 j a; b( D: i1 U2 k- wget https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 解压
' ~7 {, S; Z1 E6 F* K, q- tar -zxvf uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 进入安装目录3 p9 H7 o" e) ]" s* F
给个权限6 J7 m4 a: k# }1 b+ V
( F+ ~1 g8 E" s' B安装驱动
1 C' |( U, V/ v' v/ k一大段说明,慢慢按回车键,Y同意就行。: t! S+ Z: ~8 ~: f
安装好后打开CUPS界面,账号root,密码就是lxc设置的密码
1 p; l8 n! Z3 N4 A1 v$ F% }添加打印机就行,驱动选择HP Laser MFP 13x Series8 N$ o' Q9 a# x4 U- W/ Y3 U
Ctrl+F搜索“13”容易找到。, a2 C8 D9 |# M5 F- Q5 Z3 M: B' @
设置好后,手机也可以打印了,不用下载APP9 x; [1 o% A W1 b! h
电脑添加打印机是(举个例子)+ ?8 Y% Z4 y; B# h
- https://192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机添加打印机是(举个例子),不带http的
3 m/ L0 C" f. j$ P e- 192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机相册里可以直接打印了。 |