理论上群辉应该也可以。
' s4 }+ r! M/ h& z: [+ \# K" {! l5 R3 t' A" y( M6 y; H5 y' d
我是用PVE的LXC模版。% C1 |. b7 f C6 G% `
PVE版本号:8.4& b/ t3 X/ y2 b+ e* Y, O) ^
LXC是Ubuntu 18.04.3 LTS
& c+ v& D4 h+ ^% s0 A+ L因为用这个LXC安装了adguard home,所以也在这个上安装了CUPS,不用折腾换源了。
6 E) a3 A/ }; V0 f/ I# _7 A每种版本对应的不一样,这个版本的换源是* w8 ^- C& P! z0 q
打开文档,注释掉原来的源
3 Y# a5 W! Q" f$ Z- sudo vi /etc/apt/sources.list
复制代码 阿里云源:8 p3 d! N" `4 M# {) G0 ~. z/ P* p
- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse6 o/ l7 |; S2 G4 ]4 [" l, q
- deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
+ R8 r W, ^6 K1 {* C3 S - deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse1 j0 v# f1 L* p7 `
- deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse' T7 j r' `$ Y/ p4 `
- deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse: a' u0 j/ z# M" A
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse4 Q' @- n! e$ g7 v: |3 T) v
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
) p' H6 A8 x: {8 O - deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse3 p0 A+ ?' l& v8 M4 o) X
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse- N& L6 E/ a ^, q
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 清华源:# e9 ?0 L( g1 @3 I; n2 f
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
! Q8 r. U# t: b5 h% s5 s - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
) a8 B M6 g. U3 ~+ D: G# o/ p7 v9 ?' y - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse. S8 z: l0 H, e. n
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
" F+ k: X0 u& a( h5 f! H - deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse |* M7 t2 O: o! q4 M4 \/ h
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
+ z# z" E) o) ] Z# y - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
! \9 G0 S7 f( r7 ? - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse: p7 ^3 M' v2 M) s# }
- deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
( h9 \% S; m6 T2 Y' K: g. \. F - deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
9 g: \( V x! B
复制代码 中科大源:
( S& w9 v4 }& Q8 w! `- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
1 W3 N1 B4 g' C, s# d$ y2 W } - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse9 W4 m- g" V8 |+ X) J% X
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
& x( ^ D* [1 s! x - deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse8 z2 T' ^ r0 c4 d2 ~$ p" S4 Q+ t
- deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
/ V0 l# e, M( S0 H# y5 _$ w - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
, b! i) G0 j8 u - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
T3 r& D$ q% ? - deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse R$ p3 E( @4 d0 L% f
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse: b0 r- j2 v* H7 J/ R* C% C
- deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
复制代码 163源:9 W: u3 Z3 G1 G, L9 q
- deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
2 x, Z `$ K$ s - deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse/ I( G$ s6 E. q8 P% d7 p
- deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse4 c* Q( D+ d+ L
- deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
4 o. L" H9 \: r* D - deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse `, G6 E# {3 k4 H' |
- deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
2 K& w8 o$ v v( G* }$ a7 [0 S - deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse$ r! G( ?$ N8 i7 o
- deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
0 p; y" J1 T+ R" s) B - deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
9 B# ~8 u" J1 J/ w/ A - deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
复制代码 更改完成之后执行以下命令
! R j0 d3 i- `5 S完成后先关闭LXC,打印机插上USB5 e6 v5 e+ N8 D4 w
PVE的Shell输入lsusb查询打印机
1 p( u1 h. O$ H1 r* S; W- root@pve:~# lsusb
3 O5 a' t1 w; c9 I# R P - Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
" O# @) E: r) i) A2 _ - 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- Y M" v* w( W, F& k: `/ v9 N
- Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
复制代码 Bus 001 Device 003就是打印机,路径是dev/bus/usb/001/003$ Z* P# N' l: b
PVE的LXC - 资源 - 添加 - 设备直通 - 粘贴路径 - 确定3 [5 x8 c g/ U8 a+ m ?( D/ q
; F% A1 G, t9 w% r: Y+ r! }7 p3 M启动LXC安装 CUPS 软件及打印机驱动, m/ t9 |# U5 i% }$ _% I
- apt install cups hplip -y
7 u5 O9 k) k P- H) Q - systemctl enable cups
' h7 M, t6 q: p2 G0 G( [1 V - systemctl start cups
复制代码 编辑 CUPS 的配置文件
+ S/ a; E( M; \0 [- i% A- nano /etc/cups/cupsd.conf
复制代码 其他项按照以下修改
! m! P( |. c: g( O/ T' U0 v
2 k4 M. B9 X* L% d P- # Restrict access to the server...
& ?: L$ r& Q9 J# ?9 ? - <Location />
9 H7 ]9 v* [7 w$ G0 { - Order allow,deny5 g$ r7 t. ^1 S
- Allow all
7 T+ m9 s( X0 s0 Y. t! E/ a$ g - </Location>! P/ o! m( ~3 c0 m, I
- , d4 {9 |; g* x$ R; s: u$ o
- # Restrict access to the admin pages...' _) ?' ~! ^3 n* {
- <Location /admin>
. e' }) c) }8 z; X' h; ?8 @4 H - Order allow,deny
* b& S' e r8 n* z, A) H2 J' u; T3 a - Allow all
0 b. T/ ]: l2 D+ b5 F: | - </Location>; h/ j+ f% _" X# O' t7 Z! I
- 3 Z# g& L) ~& ?' J
- # Restrict access to configuration files...6 d/ D5 O: K& F
- <Location /admin/conf>
" Y3 U0 G& V$ g& r" | - AuthType Default
8 k* u) h# m- ]& f5 i - Require user @SYSTEM* C2 D4 _- h* [5 p
- Order allow,deny
" Y) S# `1 V/ B# a) e! N$ W5 a - Allow all
$ j1 z- I3 @/ @$ m$ f - </Location>
# t/ k+ K5 j* G1 B% g+ E. G" q - 4 M( r" A. B/ N* q1 n
- # Restrict access to log files...* @3 e ~! f, T" L: S$ i u
- <Location /admin/log>
; l" D( f# |( a, Q g$ z& M - AuthType Default
5 i+ ~* Q$ g- a# t/ }0 O4 s - Require user @SYSTEM
3 v9 }0 A2 I5 b& V, K7 g - Order allow,deny
6 w& S) l& ~; I! ]0 d$ T - Allow all
- |9 }" R5 ]8 k+ x - </Location>
复制代码 修改好后Ctrl+S 保存、Ctrl+X 退出,重启CUPS; o2 ^& }/ t/ P3 D
- sudo service cups restart
复制代码 下载惠普HP136a LINUX驱动
. ~( A6 s3 f8 r" P3 c- wget https://ftp.hp.com/pub/softlib/software13/printers/MFP170/uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 解压" f: c) Y* |6 ^
- tar -zxvf uld-hp_V1.00.39.12_00.15.tar.gz
复制代码 进入安装目录- W; d. `/ |* @$ H* H. H
给个权限
: _3 {% b! A7 S5 D0 t3 h) {2 E0 h) g5 ~+ n( F2 j
安装驱动
; \! q: ^% w* i$ p' X一大段说明,慢慢按回车键,Y同意就行。; p' K8 y" D( j$ @5 c4 `& `+ V
安装好后打开CUPS界面,账号root,密码就是lxc设置的密码
5 @( g0 k1 _ \添加打印机就行,驱动选择HP Laser MFP 13x Series
! o K! `- e% @/ VCtrl+F搜索“13”容易找到。0 ^# J# M3 c3 U% F9 E x
设置好后,手机也可以打印了,不用下载APP* b0 C7 z8 _0 C4 S9 N& @
电脑添加打印机是(举个例子)
7 d1 B+ U% T; b4 z- https://192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机添加打印机是(举个例子),不带http的
! P+ V2 H$ H) _- 192.168.10.3:631/printers/HP_Laser_MFP_131_133_135-138
复制代码 手机相册里可以直接打印了。 |