CUPS Share Printer

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CUPS Share Printer相关的知识,希望对你有一定的参考价值。

系统版本
cat /etc/centos-release
CentOS Linux release 6.0 (Final)

1、安装yum
mount /dev/cdrom /mnt
rpm -ivh /mnt/Packages/yum-3.2.27-14.el6.centos.noarch.rpm

2、安装wget
rpm -ivh /mnt/Packages/wget-1.12-1.4.el6.i686.rpm

3、备份yum配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

4、下载yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

5、yum makecache生成缓存
yum makecache

6、关闭防火墙
service iptables stop
chkconfig iptables off 开机不启动防火墙
chkconfig --list | grep iptables
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

7、关闭SELINUX
vim /etc/sysconfig/selinux
SELINUX=disabled

8、安装Cups
yum install cups
查看安装的软件包
rpm -qa |grep cups
cups-1.4.2-78.el6_9.i686
cups-libs-1.4.2-78.el6_9.i686

9、运行cups
service cups start

10、开机自动启动
chkconfig cups on
chkconfig --list | grep cups
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off

11、查看cups状态
service cups status
cupsd (pid 1817) is running...

12、允许远程访问CUPS Web
CUPS默认只监听localhost,修改配置文件,允许any监听TCP 631
vim /etc/cups/cupsd.conf

把Listen localhost:631修改为Listen *:631

允许any访问CUPS WEB
vim /etc/cups/cupsd.conf

如下增加Allow all字段

Restrict access to the server...

<Location />
Order allow,deny
Allow all
</Location>

Restrict access to the admin pages...

<Location /admin>
Order allow,deny
Allow all
</Location>

Restrict access to configuration files...

<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow all
</Location>

重启服务 service cups restart

13、访问CUPS WEB
https://IP:631/admin/
登录账号使用root密码

Add print

15、查看打印错误log
more /var/log/cups/error_log

16、安装samba
yum install samba

安装的软件包
rpm -qa |grep samba
samba-winbind-clients-3.6.23-46el6_9.i686
samba-3.6.23-46el6_9.i686
samba-winbind-3.6.23-46el6_9.i686
samba-common-3.6.23-46el6_9.i686

17、添加共享打印
vim /etc/samba/smb.conf

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
writable = no
read only = yes
printable = yes

18、重启smb服务
service smb status
smbd (pid 2140) is running...

19、设置无认证共享
vim /etc/samba/smb.conf

[global]
workgroup = MYGROUP
server string = Samba Server Version %v
security = user
map to guest = Bad User

20、测试打印

\10.4.8.249

打印一个文档,选择共享打印机,可以打印

21、通过CUPS WEB查看相关打印log
查看打印作业记录,如下,已完成一次打印

22、查看log
Page_log,如下pc-10.4.10.53使用打印机ZD-15F-PRINT-10.4.10.190完成了打印

ZD-15F-PRINT-10.4.10.190 7 root [21/Mar/2018:20:44:36 +0800] 1 1 - 10.4.10.53 smbprn.00000001 Linux - -
ZD-15F-PRINT-10.4.10.190 7 root [21/Mar/2018:20:44:47 +0800] 1 1 - 10.4.10.53 smbprn.00000001 Linux - -

以上是关于CUPS Share Printer的主要内容,如果未能解决你的问题,请参考以下文章

更改 CUPS 打印机名称

苹果放弃开源项目CUPS的开发,OpenPrinting将负责后续工作

在 Windows 中安装 CUPS

docker 运行cups 开priviledged

如何使用 CUPS 和 nodejs 打印作业

CUPS/Printer sharing