Linux局域网共享打印机(实用型文档)

参考博客:https://blog.csdn.net/u012375509/article/details/82024135

https://blog.csdn.net/qasxed/article/details/41253081

用的打印机放置的比较远,而且没有专门的打印电脑,为此需要架设局域网共享打印

这里选择了BeagleBone-Black作为终端,已经烧录Debian系统,用网线连接至局域网,USB插入HP LaserJet 1020打印机数据线

Linux局域网共享打印机(实用型文档)_第1张图片

(翻找出来的BBB)

 


0.设备与环境

  1. BeagleBone-black(简称BBB) ,运行Debian系统
  2. HP LaserJet 1020打印机,数据线插在了BBB的USB接口上
  3. 个人电脑上需安装HP LaserJet 1020打印机驱动

1.BBB上配置

a.安装HPLIP、CUPS

HPLIP(Linux Imaging and Printing Object以前有hpijs, hpoj(hpijs以前是一个单独的项目,但是ghostscript也包含了这个项目。hpoj是针对officejet的。)等开源项目,零散但是有非常有用,其中很多是非官方的,hplip是hpijs和hpoj的整合,受HP官方支持。HPLIP项目包括二进制打印机驱动(HPIJS打印机),以及打印机的维护工具(检查墨水量、清洁和校正打印头,等等)。由于该项目的支持,几乎所有的惠普打印机和一体机(打印/ 扫描/ 复印)都可以正常工作。

CUPS(Common UNIX Printing System,通用Unix打印系统)是Fedora Core3中支持的打印系统,它主要是使用IPP(Internet Printing Protocol)来管理打印工作及队列,但同时也支持"LPD"(Line Printer Daemon)和"SMB"(Server Message Block)以及AppSocket等通信协议。

$sudo apt install hplip cups

b.将用户添加到用户组lpadmin中(这里我的用户为sements)

$sudo usermod -a -G lpadmin sements

c.修改配置文件cupsd.conf

$sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak     #备份
$sudo vim /etc/cups/cupsd.conf

需要修改几处:

  • Listen localhost:631 修改为 Listen 0.0.0.0:631
  • 在  三个节点中添加 Allow all

修改后文件如下

sements@beaglebone:/etc/cups$ cat /etc/cups/cupsd.conf
#
# 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
PageLogFormat

# 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 0.0.0.0:631
Listen /var/run/cups/cups.sock

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

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

# Web interface setting...
WebInterface Yes

# Restrict access to the server...

  Allow all
  Order allow,deny


# Restrict access to the admin pages...

  Allow all
  Order allow,deny


# Restrict access to configuration files...

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


# Restrict access to log files...

  AuthType Default
  Require user @SYSTEM
  Order allow,deny


# Set the default printer/job policies...

  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  
    Order deny,allow
  

  
    Require user @OWNER @SYSTEM
    Order deny,allow
  

  # All administration operations require an administrator to authenticate...
  
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  

  # All printer operations require a printer operator to authenticate...
  
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  

  # Only the owner or an administrator can cancel or authenticate a job...
  
    Require user @OWNER @SYSTEM
    Order deny,allow
  

  
    Order deny,allow
  


# Set the authenticated printer/job policies...

  # Job/subscription privacy...
  JobPrivateAccess default
  JobPrivateValues default
  SubscriptionPrivateAccess default
  SubscriptionPrivateValues default

  # Job-related operations must be done by the owner or an administrator...
  
    AuthType Default
    Order deny,allow
  

  
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  

  # All administration operations require an administrator to authenticate...
  
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  

  # All printer operations require a printer operator to authenticate...
  
    AuthType Default
    Require user @SYSTEM
    Order deny,allow
  

  # Only the owner or an administrator can cancel or authenticate a job...
  
    AuthType Default
    Require user @OWNER @SYSTEM
    Order deny,allow
  

  
    Order deny,allow
  

d.重启CUPS服务

$sudo service cups restart

e.配置打印机共享

在浏览器中输入 https://你板子的IP地址:631/ ,点击“Administration” -> “Add Printer”

这里可能会要求你输入用户名与密码,输入你已加入lpadmin组中的用户名以及密码

Linux局域网共享打印机(实用型文档)_第2张图片

选中连接上BBB的打印机,这里我的是HP LaserJet 1020

Linux局域网共享打印机(实用型文档)_第3张图片

对打印机进行命名,记得勾选“Share This Printer”

Linux局域网共享打印机(实用型文档)_第4张图片

选择打印机制造商和型号,这里我的是HP公司的HP LaserJet 1020

Linux局域网共享打印机(实用型文档)_第5张图片

到printers页面选择你的打印机,复制地址栏的地址

Linux局域网共享打印机(实用型文档)_第6张图片

2.使用PC的配置

a.打开 控制面板 -> 硬件和声音 -> 添加打印机 在弹出窗口选择 “我所需的打印机未列出”

Linux局域网共享打印机(实用型文档)_第7张图片

b.在弹出窗口里将你的打印机地址填入,如果开头为https,将其修改为http

Linux局域网共享打印机(实用型文档)_第8张图片

至此,添加打印机的流程完成

Linux局域网共享打印机(实用型文档)_第9张图片 救救孩子,5毛买包辣条

 

 

 

 

你可能感兴趣的:(Linux,嵌入式,平平淡淡才是真)