ubuntu下打印服务器的安装配置与使用教程

为了假装学习,在某宝上剁了一台HP打印机,用了一阵子后发现个,每次打印都要开台式机(USB打印机连在台式机上),很麻烦,如果能把打印机连在NAS服务器上,就好多了。事不宜迟,马上开搞,以下是搞机的记录:

准备

  • 一台nas服务器
  • 一台hp打印机

在nas上安装打印机驱动

ubuntu上打印机的驱动安装,与具体的型号和品牌有关,hp的是通过hplip工具来实现。具体安装很简单,一路确认就可以。不确定的简单搜索就可以了,以下是参考:

hplip地址: https://developers.hp.com/hp-linux-imaging-and-printing/gethplip

安装详细过程: http://blog.csdn.net/ws_20100/article/details/49120509

安装好后本地打印一张纸试试,看看是否正常。

配置打印服务器

ubnntu下的打印服务器可以通过cups来实现。
具体的安装和配置:

  1. 安装cups

    1
    sudo apt-get install cups cups-client
  2. 备份cups配置文件

    1
    sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.bak
  3. 用以下内容代替/etc/cups/cupsd.conf:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    # /etc/cups/cupsd.conf
    # Simple CUPS configuration file for a print server
    # which serves printers within a private local area network.
    # - There is no need for additional security within the print server, ie only authorises people can access the machine.
    # This setup also allows access to the CUPS "Administrative tasks" system
    # via your web browser to http://localhost:631
    # File based on Ubuntu 5.10 (Breezy Badger) (Linux version 2.6.12-10-386)
    # Server Directives are explained in http://localhost:631/sam.html
    # 25/04/2006
    # DavidTangye@netscape.net
    ConfigFilePerm 0600
    LogLevel info
    Printcap /var/run/cups/printcap
    RunAsUser Yes
    Port 631
    Include cupsd-browsing.conf
    BrowseAddress @LOCAL
    BrowseAddress 10.0.0.0/8
    BrowseAddress 172.16.0.0/12
    BrowseAddress 192.168.0.0/16
    <Location />
    AuthType None
    Order Deny,Allow
    Deny From All
    Allow From @LOCAL
    Allow From 10.0.0.0/8
    Allow From 172.16.0.0/12
    Allow From 192.168.0.0/16
    </Location>
    <Location /jobs>
    AuthType None
    Order Deny,Allow
    Deny From All
    Allow From @LOCAL
    Allow From 10.0.0.0/8
    Allow From 172.16.0.0/12
    Allow From 192.168.0.0/16
    </Location>
    <Location /printers>
    AuthType None
    Order Deny,Allow
    Deny From All
    Allow From @LOCAL
    Allow From 10.0.0.0/8
    Allow From 172.16.0.0/12
    Allow From 192.168.0.0/16
    </Location>
    <Location /admin>
    AuthType None
    Order Deny,Allow
    Deny From All
    Allow From @LOCAL
    Allow From 10.0.0.0/8
    Allow From 172.16.0.0/12
    Allow From 192.168.0.0/16
    </Location>
  4. 重启cups

    1
    sudo service cups restart

参考资料:
如何在Ubuntu上使用网络打印-ubuntu-wiki
CUPS-wiki (简体中文)#mw-head)
如何在Ubuntu服务器上设置Web配置的打印服务器使用SWAT,CUPS和SAMBA

配置windows客户端

http://localhost:631/admin页面中找到Server Settings,选择”Share printers connected to this system”及其子项”Allow printing from the Internet”,点击”Change Setting”按钮保存设置。
进入http://localhost:631/printers/页面点击自己打印机的名字,复制跳转到的页面的URL,即打印机的地址。然后,就可以在Windows上添加使用Ubuntu共享的打印机了。
(来自 http://www.qingpingshan.com/pc/fwq/324056.html)

配置教程
win7
win10
mac