首页 > 代码库 > 设置树莓派为打印服务器,开启无线打印

设置树莓派为打印服务器,开启无线打印

# 1.开启raspberry的SSH,11月15号发布的版本默认不开启.
# 2.启动root用户,执行此命令后系统会提示输入两遍的root密码,输入你想设的密码即可,然后在执行
sudo passwd root

# 解锁root账户
sudo passwd --unlock root

# 3.更新软件
sudo apt-get update -y
sudo apt-get upgrade -y

# 4.安装CPUS以及相关服务
sudo apt-get install cups -y
sudo apt-get install samba -y

# 5.将默认pi用户添加到group中
sudo usermod -a -G lpadmin pi

# 6.停止cups服务并更新配置文件
sudo service cups stop

# 7.备份配置文件
sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak

设置cupsd.config文件,修改部分如下 :

#
# Sample configuration file for the CUPS scheduler.  See "man cupsd.conf" for a
# complete description of this file.
#

# Log general information in error_log - change "warn" to "debug"
# for troubleshooting...
LogLevel warn

# Deactivate CUPS‘ internal logrotating, as we provide a better one, especially
# LogLevel debug2 gets usable now
MaxLogSize 0

# Only listen for connections from the local machine.
Listen *:631
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd
BrowseAllow all

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Web interface setting...
WebInterface Yes

# 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>

 

# 启动printer
sudo service cups start

# 设置静态ip
sudo vi /etc/dhcpcd.conf

# 添加如下内容后重启
interface wlan0
static ip_address=10.0.0.x/24
static routers=10.0.0.1
static domain_name_server=8.8.8.8

 

设置树莓派为打印服务器,开启无线打印