樹莓派之打印服務器配置
為什麽要做這個服務器了,因為公司有HP1020家用打印機數量驚人,且公司已經徹底進入了雲桌面時代,為方便管理及提供穩定性特定做了這個樹莓派的打印服務器。言歸正傳:HP1020是一款非常經典的激光打印機,雖然有升級的帶網絡的HP1022N,但是從成本角度出發不可能一次性把所有的打印機都替換掉。有人問為什麽不買其他市場的打印服務器了?原因很簡單,因為HP1020不支持任何打印協議,只能直接主機打印。
準備樹莓派
首先我們需要1個樹莓派2代或者3代、一張4GB的TF卡、一個樹莓派的電源、樹莓派的外殼等等、、
準備系統鏡像
http://mirror.centos.org/altarch/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1611-RaspberryPi2.img.xz
http://mirror.centos.org/altarch/7/isos/armhfp/CentOS-Userland-7-armv7hl-Minimal-1611-RaspberryPi3.img.xz
燒錄系統鏡像
使用Win32Disk燒錄以上的鏡像到TF卡中,燒錄完成之後將TF卡插入樹莓派。
執行hplip、cups、及系統相關配置
網卡設置、selinux設置
vi /etc/selinux/config
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
IPADDR=192.168.122.242
GATEWAY=192.168.122.1
ONBOOT=yes
DNS設置:vi /etc/resolv.conf
nameserver x.x.x.x
以上設置完成以後我們重啟centos
shutdown -r now
從新登陸以後執行以下shell即可實現打印服務器及相關打印驅動的安裝
#!Author Bryce_Zhang systemctl stop firewalld #停止firewalld防火墻 systemctl mask firewalld #禁言防火墻 yum update -y yum install vim wget make gcc bc foomatic ghostscript cups iptables-services openssl openssl-devel hplip -y #安裝我們所需要的組件及相關依賴包 systemctl enable iptables.service systemctl start iptales.services iptables -A INPUT -p tcp --dport 631 -j ACCEPT service iptables save systemctl restart iptables.service cd /tmp wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz tar zxvf foo2zjs.tar.gz cd foo2zjs make ./getweb 1020 make install && make install-hotplug
#配置Cupsvim /etc/cups/cupsd.conf <Location /> Order allow,deny allow all #將網絡改為ALL允許所有網絡訪問,此配置針對不同VLAN網絡 </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny allow all #將網絡改為ALL允許所有網絡訪問,此配置針對不同VLAN網絡 </Location> # Restrict access to configuration files... <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny allow all #將網絡改為ALL允許所有網絡訪問,此配置針對不同VLAN網絡 </Location> Listen 0.0.0.0:631 #將local監聽改為0.0.0.0
systemctl start cups #啟動Cups服務 systemctl enable cups
發布打印機
使用http://樹莓派IP:631 訪問Cups,點擊Administration輸入root密碼進入管理界面,將打印機的USB插入我們的輸煤之上。
點擊Add Print發布打印機,選擇Local Printers中的HP1020打印機點擊Continue。選擇Share The Printers,點擊Continue,選擇HP1020-Foomatic-Foo2zjs-z1-recommended 註意一定要選擇recommended版本的驅動。
發布完成以後、我們使用一下鏈接鏈接打印機 http://樹莓派IP:631/printers/1020 這裏的1020取決你設置的打印機名字。
樹莓派之打印服務器配置