理论上群辉应该也可以。9 Y" F2 m1 L$ s Y9 I+ X% G
1 v3 _: ~: Z6 {) R) d8 h: l5 n
我是用PVE的LXC模版。( D+ k" X; `# ^( g. R6 f1 k: U
PVE版本号:8.4
* S' S4 K$ [2 y4 L( D: f2 gLXC是Ubuntu 18.04.3 LTS/ R/ x7 @- X* I) Y" \7 M( s. c
因为用这个LXC安装了adguard home,所以也在这个上安装了CUPS,不用折腾换源了。/ J% E' \/ N/ `0 `- R# s! {' m7 w5 @
每种版本对应的不一样,这个版本的换源是
' a( B! f( Y0 O: u- ?打开文档,注释掉原来的源, c9 U3 @) }2 i3 f7 }2 F7 c
- sudo vi /etc/apt/sources.list
复制代码 阿里云源:
: {/ O2 T9 j X$ i1 ?- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
1 e7 {& U \9 \0 I4 E - deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
5 ]2 T B& G9 y2 w9 g% J5 d' c - deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# }1 A& j# e6 R; N+ T f - deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
5 @* f) u2 b x5 p - deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
! ^0 O& p3 \" e3 P% o e: ? y, z. f - deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
$ K7 P. v. A5 u! R# f5 f - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
& v9 \& Q& B2 e( ~2 y/ Q2 F - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
" D1 a5 a" H2 Q3 `( N - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse2 x. r- A: h5 S, c- L) {( a# N0 z
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 清华源:
- z5 G1 f: d% o6 ^5 y- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse7 Y' {' q8 `; e: l5 x3 R
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
$ \3 k* g2 N: G. a - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse3 L$ E8 J. {: d: ?& h6 b4 {
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
6 `% u: J3 @/ g1 K - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
9 G, U J- I* j - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
7 h4 ?) ]; A4 ]4 l5 ~) g - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse H& }) p+ @4 q/ c( _
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
9 `# `% Z% _0 z" S) T# j - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse/ J0 w. ~3 [' H/ U$ P
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse6 `2 [& _( x4 Q* _
复制代码 中科大源:4 u8 Y& q) }5 S u; q3 m% v
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse2 n% O- |. P! E9 M
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
! b, |% Y* }. X. a6 f# _+ t - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse V6 l6 F. O- J8 M P
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse' l1 _* J7 F1 E: _
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse2 K1 ^( z5 _" m( t' q. D8 B0 C
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
1 S L4 } c# I+ B - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse' v/ |" \6 |2 \2 a
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse L; l: }1 T0 j3 i$ ]
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
% q) y: X5 C6 L: y6 Z - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
复制代码 163源:& u# V1 Q8 s/ L- ?+ g8 o
- deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
+ u D' P: A% j/ I - deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse; @7 u2 S m+ ?$ \$ P. Y; m
- deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
+ `" m: w P _' n: _ - deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse& J" e6 V1 [: u- I, ]
- deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse8 V) v0 Y; {. [5 n' m1 L v3 [% z( n
- deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse2 z& y8 \' k0 K9 C# d; g' T
- deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse Q' r- k2 Z, }1 D2 k
- deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse0 F6 A% v9 F3 ^
- deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
- t1 U: I8 j% v' Q( ~ - deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 更改完成之后执行以下命令
/ J( l2 C1 S2 t' L+ K) ]5 {完成后先关闭LXC,打印机插上USB/ I5 L O) v, w$ k! j' @6 ~4 w
PVE的Shell输入lsusb查询打印机
' `" Y M* p" ^1 s6 o- root@pve:~# lsusb
& f. i: x3 S& |! r& R7 B" u - Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
- j7 U- x; l E3 {, }3 U) p - 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
' l: S' f6 X* e( r - Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
复制代码 Bus 001 Device 003就是打印机,路径是dev/bus/usb/001/003
+ {% w, [) c; kPVE的LXC - 资源 - 添加 - 设备直通 - 粘贴路径 - 确定9 J( l3 d+ [4 D; m( Q
- @0 u: q5 l2 k启动LXC安装 CUPS 软件及打印机驱动
' L; m+ A' S j0 r: l- apt install cups hplip -y+ t8 n1 Y. C( g7 c+ }
- systemctl enable cups, m- n, Z/ M$ `7 g$ @5 K! L( c
- systemctl start cups
复制代码 编辑 CUPS 的配置文件5 J9 |* k# z; a6 G. e7 x+ y# ]
- nano /etc/cups/cupsd.conf
复制代码 其他项按照以下修改 H( y: M& l! a- m: Y
: a5 ~3 I1 x9 f2 R2 ~( u2 T+ L
- # Restrict access to the server...0 h' }/ F$ y* A( y6 w2 v
- <Location />
+ x3 t. Q2 @: t5 K# A# \+ M, z - Order allow,deny" t: a( Y: |+ r ~+ p
- Allow all
) m$ E& Q2 H5 \2 Q7 m - </Location>
E/ P7 Z) J0 i5 y9 N* \. F3 \ - 8 C- ?1 k* S Y4 R% B# {
- # Restrict access to the admin pages...
! l8 [0 K4 e+ d; n3 }9 h8 { - <Location /admin>3 }7 i( f: s6 v7 M" P
- Order allow,deny! D7 v3 V% n9 K z
- Allow all
, c3 _/ v, i J2 P' U - </Location>
$ [% ~" J1 Z' j& T, G - . j; B: f, Y# G. k- t. t
- # Restrict access to configuration files...+ {$ o4 b/ I. `+ n& V- O9 {
- <Location /admin/conf>6 O. D4 c \% c3 W
- AuthType Default
) X: m. R% t" O - Require user @SYSTEM
1 M6 ]! p+ Y9 H" s" y6 g: L - Order allow,deny
# h) D7 k6 Z2 w - Allow all" A1 P6 f S% C Q" [5 I% b
- </Location>% L- o# ]$ K' O) `
- 6 h% Y* X7 k# v! T
- # Restrict access to log files...
; i8 O+ |0 C+ q" }( ^/ C - <Location /admin/log>
6 r: l# h% I( l - AuthType Default; {3 h C) i- t
- Require user @SYSTEM
) Y+ O& Z" [, I% r7 r/ u - Order allow,deny
* Z2 c) V3 i* M0 N6 B - Allow all
! k. K; s* U$ ]8 G( C2 J6 E6 C - </Location>
复制代码 修改好后Ctrl+S 保存、Ctrl+X 退出,重启CUPS) a5 N% [ s7 M1 g8 _( M5 i
- sudo service cups restart
复制代码 下载惠普HP136a LINUX驱动
( ^9 r3 c# }* Y1 h- ?' E @0 E6 R- wget https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 解压0 k- j9 s3 V) Y e+ [
- tar -zxvf uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 进入安装目录. L+ e, |6 r% ^. c0 Y9 |
给个权限
- l% O2 `& d9 v: `) K# g, E
2 ?7 I2 V. ^/ g" b; b( g安装驱动
( }+ a4 E5 }% h* c' Q# o7 W x一大段说明,慢慢按回车键,Y同意就行。
: ^" I K. b1 Q9 h: K; W安装好后打开CUPS界面,账号root,密码就是lxc设置的密码% }% Q( a) F: k* z
添加打印机就行,驱动选择HP Laser MFP 13x Series. E/ c6 i- `) _( O! V
Ctrl+F搜索“13”容易找到。
1 v9 E: _+ a( G# e9 ]2 \6 n+ f) M' U设置好后,手机也可以打印了,不用下载APP- L: S6 u- b ~$ j9 q0 f
电脑添加打印机是(举个例子)
9 h) w; s* u3 t( \- https://192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机添加打印机是(举个例子),不带http的
1 P: V" c: F5 V3 B- 192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机相册里可以直接打印了。 |