Raspberry Pi Print Server With AirPrint (iOS) Compatibility

I was looking for a low cost way for my family to print from their iPhones, iPods and iPads when I realized that this would be a good job for my Raspberry Pi. The web is littered with instructions for this project. I mostly followed Lynsay Shepherd’s tutorial but not exactly. The steps I followed are below.

  1. First update and upgrade to be sure Raspbian is fully up to date. From the command line type the following and hit enter:
    sudo apt-get update
  2. From the command line type the following and hit enter:
    sudo apt-get upgrade
    For both of these steps if you’re prompted to continue just say yes.
  3. Next install the packages needed for this project. From the command line type the following and hit enter:
    sudo apt-get install avahi-discover cups cups-pdf python-cups
    When prompted to continue just say yes. It may take a while for all of these packages to install so be patient.
  4. Add our username to the CUPS server so we’ll be able to administer the server. From the command line type the following and hit enter:
    sudo usermod -aG lpadmin pi
    This will add the user pi to the list of admins on the CUPS server. If you want to add other users use the same command but replace pi with the username you want to add.
  5. Start the server to be sure it installed correctly. From the command line type the following and hit enter:
    sudo /etc/init.d/cups start
    If all went well you’ll see the following line and then be back at the command line:
    [ ok ] Starting cups (via systemctl): cups.service.
  6. Edit the CUPS configuration. From the command line type the following and hit enter:
    sudo nano /etc/cups/cupsd.conf
  7. Set up the port that CUPS will listen on. Look for the line that says “Listen localhost:631” and put a # in front of it to comment it out and type the following on the next line:
    Port 631
  8. Set up access control. Arrow down in the config file until you see the following:
    # Restrict access to the server...
  9. After the line that says “Order allow,deny” add a new line and type the following:
    Allow @Local
  10. Repeat step 9 for the following sections:
    # Restrict access to the admin pages...
    # Restrict access to configuration files...
  11. Hit CTRL-X to exit nano. When prompted to save be sure to say yes and hit enter to confirm the file name.
  12. Restart the CUPS server to be sure the changes take affect. From the command line type the following and hit enter:
    sudo /etc/init.d/cups restart
    If all went well you’ll see the following line and then be back at the command line:
    [ ok ] Starting cups (via systemctl): cups.service.

The server is now set up. Let’s add a printer. Be sure your printer is attached to the Pi then do the following:

  1. Launch a web browser and go to https://192.168.1.X:631 (Use the IP address of the Pi and go to port 631.) If prompted that the page is unsafe click the option that will allow you to continue to the page.
  2. Click Administration.
  3. Click Add Printer in the Printers section. If prompted for a username and password enter the username and password for the pi account.
  4. In most cases your printer will be listed in the Local Printer section of the next page. Click the radio button next to it and click the Continue button.
  5. On the next page be sure to click the Share This Printer box. Feel free to change the Name, Description and/or Location fields (or not). Then click the Continue button.
  6. On the next page select the appropriate printer driver for your printer. If your printer isn’t listed consult your printer manufacturers website for the Linux driver for your printer. (I had to run ‘sudo apt-get install hplip‘ to add my HP printer to the list.) If your driver is in a separate file then click the Choose File button in CUPS, navigate to the driver and click the Open button.
  7. Click the Add Printer button.

The next page is to set default settings for the printer so we won’t worry about that now. Let’s print a test page to see if this all worked.

  1. Click Printers.
  2. From the Maintenance menu click Print Test Page.
    If all went well your printer will print a test page.

Printing from Mac OSX and iOS should now work with no additional setup. For Windows, however, we need to continue install and configure SAMBA.

  1. From the command line type the following and hit enter:
    sudo apt-get install samba
    When prompted to continue just say yes. It may take a while for all of these packages to install so be patient.
  2. Once SAMBA was installed my Windows machines were able to print. If your Windows machines can’t find the printer then edit the SAMBA configuration. From the command line type the following and hit enter:
    sudo nano /etc/samba/smb.conf
  3. Look for the line that says “[printers]” and add the following above it:
    printing = cups
    printcap name = cups
  4. In the [printers] section change the ‘guest ok‘ setting to yes.
  5. In the [print$] section change ‘path‘ to /usr/share/cups/drivers
  6. Hit CTRL-X to exit nano. When prompted to save be sure to say yes and hit enter to confirm the file name.
  7. Reboot the Pi to be sure all is well.

At this point everything should work. However I had a Windows 10 machine that wasn’t working quite right. After some searching I found the solution outlined here worked for me.

Tags: , , , , , ,

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)