设为首页 收藏本站
查看: 948|回复: 0

[经验分享] CentOS 6.2 + CUPS + AirPrint for iOS

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-2-5 08:48:03 | 显示全部楼层 |阅读模式
混合环境下的打印方法的选择。


So we share our printer via IPP using CUPS. What the heck is IPP? It's just printing overHTTP. Why use IPP versus, say, Windows Printer Sharing? Simple: we've got a mixedenvironment of Windows XP, Windows 7, OS X 10.6, OS X 10.7, Fedora, Ubuntu, and CentOSworkstations. IPP is supported by all of them. Plus, I could get AirPrint to work on it,which means you can add iOS in that list of Operating Systems above.
CUPSSo obviously you need to get CUPS to work first.
yum install cups ghostscript usbutilsSo there's the cups package, ghostscript, and usbutils. Since most printers these days areconnected via USB, it's always nice to have usbutils installed. Ghostscript is neededsince most printers don't really support PostScript so I install it just in case.
So once you've got those installed, you need printer drivers. With so many differentprinter manufacturers, I leave that up to you, dear reader, as to how to install it.You'll usually need a PPD file. NOTE: if you're printer is supported via foomatic orgutenprint, you can install drivers via:
yum install foomatic gutenprint-foomaticThis should install most drivers available. For example, we have an old Samsung ML-1510that is supported by foomatic. We do have a newer Samsung ML-1860 that isn't. Thatrequired me to download and install Samsung's Unified Printer Driver (ugh). Its installscript installed a bunch of .desktop files for every account on our server. So I had tosearch the entire server and remove all of these useless files. To Samsung: sheesh. Thisalso installed an initscript called smfpd, which is a daemon for parallel port printers.Again, sheesh. You can't disable this from startup via chkconfig. There is a commented out"exit 0" near the start. Uncomment that and the daemon should stop running on startup.Make sure you stop the daemon first as it consumes a bit of CPU and memory. Sheesh. Sorryfor the semi-rant.
Anyway, the default CUPS configuration only allows access to localhost. Since I don'tworry too much about security, and you can secure it after, I change the following in/etc/cupsd.conf:
I add the following:
ServerAlias *Port 631which makes the server listen to any hostname (our server has a CNAME to it calling it'printer01') on port 631.
Then I make sure to change all "Order deny,allow" to "Order allow,deny" and add an "Allowall" to everything after. This way, I can now remotely access the web GUI at:
http://hostname:631/Change hostname for whatever you call your print server. If at anytime you're asked for ausername and password, use your server's root account. So now that you have access to theweb GUI, simply add your printer here.
Now you should be able to start CUPS:
service cups start && chkconfig cups onTest your printerSo you should be able to add your printer to your workstations. The whole URL to yourprinter is:
http://hostname:631/printers/PRINTERNAMEor:
ipp://hostname/printers/PRINTERNAMESpecial note for Mac users: for the "Queue" setting, make sure you include the"printers" portion. So 'Address' would be the hostname. 'Queue' would be"printers/PRINTERNAME".
Once you've added the printer and selected/installed the correct driver, you should begood to go.
If not, there is a setting called 'LogLevel'. By default it's set as follows:
LogLevel warnChange it to:
LogLevel debugand monitor the log files in /var/logs/cups/error_log for any problems.
AirPrintSo now for the fun part: getting AirPrint to work so users can print from their iPhonesand iPads. There are some great references online, plus a great script to automaticallygenerate the configuration files needed to get your printer advertised by Avahi.
So, Timothy J. Fontaine of Ataraxia Consulting created a python script that automaticallygenerates a .service file for the printers connected via CUPS. You can read hisblog postabout it. The GitHub repository is available here:
https://github.com/tjfontaine/airprint-generate
Anyway, you can (hopefully) download the file directly here:
https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py
First you'll need to install Avahi:
yum install avahi avahi-compat-libdns_sdThen you need to install the Python cups module. For CentOS 6.2, this is, strangely, inthe "system-config-printer-libs" package. So:
yum install system-config-printer-libsThen you can run the airprint-generate.py script. Copy the generated .service files into/etc/avahi/services. Then you can start the service:
service avahi-daemon start && chkconfig avahi-daemon onI had some trouble with printers not being advertised. Since my local network is on br1instead of eth1 (a KVM thing), I had to add the following to /etc/avahi-daemon.conf:
allow-interfaces=br1If you had to add that, restart avahi-daemon.
And that's it. Printers should start showing up on your iOS devices.


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-42003-1-1.html 上篇帖子: rsync 常见错误及解决方法 下篇帖子: yum只下载软件不安装的两种方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表