打印服务器cups安装笔记

January 20, 2023 686hotness 0likes 0comments

CUP 安装笔记

CUP 介绍


CUPS 是Apple inc 开源的打印服务 ,你可以将它部署在您的局域网内,将打印机接入该服务器,其它工作站可以通过局域网来访问打印机。

Official website:
http://www.cups.org/index.html
Github page:
https://github.com/apple/cups

CUPS支持局域网内打印服务共享,无需再繁琐的设置打印机共享了,并且还能将老打印机也接入局域网。同时还支持mac os, linux,windows,安卓以及ios air print;

笔记概要

  • Linux服务器版本 Ubuntu 18.4
  • 下载并安装CUP
  • CUP配置修改
  • 使用WEB GUI 添加打印机
  • 通过局域网访问打印机
  • 配置文件说明

下载安装

 sudo apt-get install cups cups-pdf cups-bsd #下载安装

CUP 配置修改

sudo cp /etc/cups/cupsd.conf  cupsd.conf.bak #备份配置文件
sudo nano /etc/cups/cupsd.conf  #修改配置文件
#
1. Configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
1. complete description of this file.
1. 
1. Log general information in error_log - change "warn" to "debug"
1. for troubleshooting...
LogLevel warn
PageLogFormat
 1. Deactivate CUPS' internal logrotating, as we provide a better one, especially
1. LogLevel debug2 gets usable now
MaxLogSize 0
 1. Only listen for connections from the local machine.
Listen 631  #更改监听端口
Listen /run/cups/cups.sock
 1. Show shared printers on the local network.
Browsing on #打开局域网发现打印机
BrowseLocalProtocols dnssd
 1. Default authentication type, when authentication is required...
DefaultAuthType Basic
 1. Web interface setting...
WebInterface Yes
 1. Restrict access to the server...
<Location />
  #Order allow,deny
  Allow @LOCAL  #允许LOCAL 
</Location>
 1. Restrict access to the admin pages...
<Location /admin>
  #Order allow,deny
  Allow @LOCAL  #同上
</Location>
 1. Restrict access to configuration files...
<Location /admin/conf>
  #AuthType Default
  1. Require user @SYSTEM
  #Order allow,deny
  Allow @LOCAL
 </Location>
 1. Restrict access to log files...
<Location /admin/log>
  #AuthType Default
  #Require user @SYSTEM
  #Order allow,deny
  Allow @LOCAL
</Location>

修改完配置之后重启服务

sudo systemctl retsart cups #重启服务
sudo systemctl enable cups #设置开机启动

到这里就可以使用局域网访问WEBGUI并添加打印机

配置文件说明

MaxLogSize 2000000000  #最大日志,当日志文件超过此值时,开始循环
 LogLevel info  #需要记录的日志等级
 SystemGroup sys root  #CUPS的系统管理组名称
 Listen localhost:631  #WEB管理监听的IP和端口号
 Browsing On  #允许客户端浏览打印机
 BrowseOrder allow,deny #访问权限设置,deny列表取代allow
 BrowseAllow @LOCAL  #除了以@LOCAL结尾的帐号外
 DefaultAuthType Basic
 <Location />  #系统默认认证
   Order allow,deny
   Allow localhost  #只允许本机访问
 </Location>
  
 <Location /admin>  #基于管理功能的访问认证
   Encryption Required
   Order allow,deny
   Allow localhost #限制只允许本机访问
 </Location>
 

小四

喜欢摄影 和IT

Comments