CUPS共享打印机服务

系统版本

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


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

#允许any访问CUPS WEB

vim /etc/cups/cupsd.conf

如下增加Allow all字段
# Restrict access to the server...

  Order allow,deny
  Allow all


# Restrict access to the admin pages...

  Order allow,deny
  Allow all


# Restrict access to configuration files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all


重启服务 service cups restart

13、访问CUPS WEB

https://IP:631/admin/
登录账号使用root密码

14、添加打印机

image.png

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、测试打印

windows下访问共享打印机

\\10.x.x.x

21、通过CUPS WEB查看相关打印log

查看打印作业记录,已完成一次打印

PRINTServer-10.4.x.x 7 root [21/Mar/2018:20:44:36 +0800] 1 1 - 10.4.x.x smbprn.00000001 Linux - -
PRINTServer-10.4.x.x 7 root [21/Mar/2018:20:44:47 +0800] 1 1 - 10.4.x.x smbprn.00000001 Linux - -

你可能感兴趣的:(CUPS共享打印机服务)