Okay, well, this was a PITA. But, it’s working now.
First off, references that were usefull:
apt-get and install the following:
First step: CUPS has a webserver that allows you to configure printers using the browser, much easier than editing the .conf files directly. It is designed to be accessed via http://localhost:631/admin. And locked down thusly. First, edit /etc/cups/cupsd.conf, and perform the following edits:
- After ‘SystemGroup lpadmin’, add ‘ServerAlias *’ – this allows requests that are forwarded by avahi-daemon to come from ‘hostname.local’ without error. Otherwise you will get in your cups error log: “E [21/Dec/2012:13:05:37 -0500] Request from “10.0.0.192” using invalid Host: field “ops1-00.local””
- Find the ‘Port locahost:631′ line, and change it to just ‘Port 631′, this will allow connections from other machines on your network.
- For each stanza ‘<Location xxxxx>’, just after ‘Order xxx’ line, add ‘Allow all’. Specifically for locations ‘/’,’/admin’,’/admin/conf’. This will allow connections from other machines. But beware, this will open things up a bit on your local network.
- Add your local user account to the lpadmin group ‘usermod -aG lpadmin username’. You’ll need this to auth to cupsadmin later.
- Create a new file ‘/usr/share/cups/mime/apple.types’ with only one line ‘image/urf urf (0,UNIRAST)’, without the quotes.
- Create a new file ‘/usr/share/cups/mime/local.convs’ ‘image/urf application/vnd.cups-postscript 66 pdftops’ without the quotes
- restart cups ‘service cups restart’.
- Logon and configure your printer in a web-browser. Enable sharing of the new printer.
- On the Administrative tab, check ‘Share printers connected to this system’.
- Test your printer.
Now the avahi part:
- mkdir -pv /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 755 ./airprint-generate.py
- Edit airprint-generate.py, in the section setting ‘DOCUMENT_TYPES’, add a new line just under “‘application/postscript': True,” that says “‘application/vnd.cups-postscript': True”.
- The above will generate a file in your local directory for the printers that you have setup in CUPS. The other steps below are from the webpage of the person, but not sure why they are needed.
- cp ./*.service /etc/avahi/services
- ./airprint-generate.py -d /etc/avahi/services
- service avahi-daemon restart
That’s about it. Troubleshooting:
- Verify that it’s listening on it’s multicast port: ‘netstat -ng’, you should see 22.214.171.124′ in there when avahi-daemon is running.
- Verify that CUPS is listening on 631: ‘netstat -anop | grep LISTEN’ (needs root).
- Check CUPS logs in /var/log/cups/* ‘tail -f /var/log/cups/*’
- Check avahi-daemon messages in /var/log/syslog ‘tail -500 /var/log/syslog | grep avahi-daemon | less’
- Install tcpdump, and check multicast traffic ‘tcpdump ether multicast’, or check ‘tcpdump port 631′ traffic for cups.
- Many changes require restarts to both daemons, so ‘service cups restart; service avahi-daemon restart’
NOTE: this works well on my hp laserjet 2550 networked printer using postscript. Others may have different experiences.