CUPS + AirPrint on Raspberry PI

Install CUPS and Enable Remote Access

apt-get install cups

Add Pi user to lpadmin group

usermod -aG lpadmin pi

Enable Remote Access

/etc/cups/cupsd.conf

Comment out Listen localhost:631 and add Port 631

then Allow access

# Only listen for connections from the local machine
# Listen localhost:631
Port 631


< Location / >
# Restrict access to the server...
Order allow,deny
Allow @local
< /Location >

< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow @local
< /Location >

< Location /admin/conf >
AuthType Default
Require user @SYSTEM

# Restrict access to the configuration files...
Order allow,deny
Allow @local
< /Location >

Restart CUPS

/etc/init.d/cups restart

Now you are able to access remotely x.x.x.x:631 and add the printer

Install AirPrint

apt-get install avahi-discover cups cups-pdf python-cups

apt-get install hplip

Make your old printer AirPrint capable

 
/etc/init.d/avahi-daemon start
mkdir /opt/airprint
cd /opt/airprint
wget -O airprint-generate.py --no-check-certificate https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py
chmod +x airprint-generate.py
./airprint-generate.py -d /etc/avahi/services
/etc/init.d/avahi-daemon restart
ls /etc/avahi/services/

Add those files with this content

/usr/share/cups/mime/local.convs


image/urf application/vnd.cups-postscript 66 pdftops

/usr/share/cups/mime/apple.types

image/urf urf (0,UNIRAST)

/usr/share/cups/mime/apple.convs

image/urf application/pdf 100 pdftoraster

Open port 631

iptables -A INPUT -i eth0 -p tcp -m tcp --dport 631 -j ACCEPT
iptables -A INPUT -i eth0 -p udp -m udp --dport 631 -j ACCEPT

Disable power saving (optional)

/etc/modprobe.d/8192cu.conf
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1
 

Connect from windows

http://server_ip:631/printers/printer_name

seo reseller