CUPS with Apple AirPrint

The following guide will install CUPS for printer support, Webmin for easy printer management, and an Apple AirPrint server. You'll be able to print to a shared printer from Windows, Mac OS X, Linux, and even iOS devices like the iPhone, iPod Touch, and iPad.

Installation
1. Install required packages:
pacman -Sy cups cups-pdf gutenprint pycups avahi python2

2. Add "cups", "cups-pdf" and "avahi-daemon" to the daemons line in /etc/rc.conf, after "sshd".

3. Plug a USB printer in to your device.

4. Start cups to generate some files that we will be editing later.
/etc/rc.d/cups start

5. Download and install Webmin. We will be using Webmin to enable USB printing, but it has a variety of other roles.
pacman -Sy webmin

6. Go to the Webmin configuration file to allow access from network computers.
nano /etc/webmin/miniserv.conf

7. Change the last line to allow computers on your home network.
allow=127.0.0.1 192.168.1.0

8. Start Webmin and access its web interface in a browser by going to http://your.arch.arm.ip:10000". Log in as the root user. Click the left-hand "Hardware" link and then click "Printer Administration".
/etc/rc.d/webmin start

9. Click on "Add a New Printer" and go through the steps to add a name and description.

10. In "Print Destination" select "USB Printer 1" then click "Create" at the bottom of the window, this will allow you to log onto the CUPS web interface when it is appropriate.

11. Now, shut down CUPS and go to the printer configuration file.
/etc/rc.d/cups stop nano /etc/printers.conf

12. Change this line:
DeviceURI usb:/dev/usblp0

to:
DeviceURI file:/dev/usblp0

Use CTRL-X and then Y to save these changes.

13. Go into the CUPS configuration file:
nano /etc/cups/cupsd.conf

Allow the IP address of the administrative computer and the IPs of all the computers you want to have access to the print server:
# Restrict access to the server to your local network: <Location /> Order allow,deny allow 192.168.0.1 192.168.0.* 192.168.0.*** </Location>
# Restrict access to the admin pages... <Location /admin> Order allow,deny allow 192.168.0.* </Location>

14. The "cupsd.conf" file will give you a lot of great information, but really you don't need to change much, except who has access to your printers. Add the following important text to allow printing to a "file" location on the server as well as enabling other CUPS add-on features such as AirPrint by adding a ServerAlias line anywhere within the conf file after you have altered the various lines:
FileDevice Yes ServerAlias *

Press CTRL-X then Y to save changes.

Start the CUPS server and log into the web interface on "http://your.ip.address:631".
/etc/rc.d/cups start

15. Click on the "Printers" tab on the far right and click on the name that you had entered for your printer in Webmin. Click on the drop-down script that reads "Administration" within the "Printers" tab and select "Modify Printer". The selection will read something like:
"Connection: file:/dev/usblp0"

Click "Next" and select all the information showing how your printer will show up on your network and input the appropriate information for Gutenprint to assign a driver for your printer.

16. Click "Create" at the end of these options and take note of the location of the printer. This is very important for allowing your Linux/Mac OS X/Windows computers to access the print server. It will probably be something like:

"http://your.ip.address:631/printers/nameofprinter"

17. That's it! Print a test page and add a network printer by following the instructions based on your OS. As long as you add a network printer via the IP, the address you took note of earlier should suffice to allow the computer to connect.

Apple AirPrint for iOS
You can easily enable Apple AirPrint for iOS devices by following these steps.

1. Start "avahi-daemon" and add "avahi-daemon" to the /etc/rc.conf file's DAEMONs.
/etc/rc.d/avahi-daemon start

2. Download the python script for the AirPrint configuration.
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

The file is mirrored at "http://plugapps.com/mirror/other/airprint-generate.py".

3. Since we are running python2, we need to change a line so that our script will function.
nano /opt/airprint/airprint-generate.py

Change the line from:
#!/usr/bin/env python

to:
#!/usr/bin/env python2

4. Use CTRL-X and Y to save the file. Then run the downloaded script and move the service file to the Avahi "services" directory:
chmod 755 airprint-generate.py ./airprint-generate.py mv AirPrint-SomePrinter.service /etc/avahi/services

and then,
./airprint-generate.py -d /etc/avahi/services

5. Restart the server (remember to unplug all USB drives except the flash drive with Arch Linux ARM). Once the server has restarted, all Linux, Windows, Mac OS X, and iOS devices should be able to print wirelessly to the printer. Good luck and feel free to ask questions in the Forum.