Raspberry Pi and ArchLinux – Install a print server with CUPS and AirPrint

dcp_770cw

I left a blank ArchLinux configuration. So some packages will be either unnecessary or already installed you if your Raspberry is configured for some time.

Attention : I made many tests with my “former” Raspberry that had only 256 MB. Cannot print a test page. I took the SD card and I put it in a model with 512 MB and presto print of glance !

The problem seems to come from ghostscript which, on the 256 MB model, does not have enough memory to prepare the files to print.

Apple wireless printing functionality will be able to be reproduced through two main components :

  • Avahi which allows to know the services via the network
  • Cups for drivers to print

For information, my home my printer is an Epson SX218 but no reason that you cannot do the same thing !

  1. Update distribution
    Pacman - Suy
  2. Install the system initialization scripts to have the script RC.conf Basic
    Pacman-s initscripts
  3. Install the packages on CUPS and Avahi and some dependencies (430MB to install !). pycups will have a web interface to configure your print server
    Pacman - Sy cups cups-pdf gutenprint pycups avahi python2
  4. Add the following services to the daemons launched at startup
    DAEMONS =(hwclock syslog-ng network netfs crond sshd cups cups-pdf avahi-daemon)
  5. Restart the Raspberry and ensure that cups and avahi are launched
    ps - ef | avahi ps - ef grep | grep cups
  6. It is now necessary to change the configuration of CUPS to take into account the access to our server from any machine on the local network. My home LAN is with type 192.168.1.X IP. Edit the file /etc/cups/cupsd.conf
    # Restrict access to the server....
    
    <Rental.>
    
      Order allow,deny
    
      Allow 192.168.1.0/24
    
    </Rental>
    
    # Restrict access to the admin pages....
    
    <Rental/Admin>
    
      Order allow,deny
    
      Allow 192.168.1.0/24
    
    </Rental>
    
    
  7. Always in the file /etc/cups/cupsd.conf, change the following line
    Listen localhost:631

    by

    Port 631
  8. Always in the file /etc/cups/cupsd.conf, Add the following lines at the beginning of file. ServerAlias is required for AirPrint functionality.
    # Log general information in error_log - Exchange "warn" to "debug"
    
    # for troubleshooting....
    
    #LogLevel warn LogLevel debug
    
    ServerAlias *
    
    # Administrator user group....
    
    SystemGroup sys root
  9. We must now be able to access the web server integrated with CUPS as defined in the http configuration file://<ip_raspberry>:631cups-1
  10. You can now connect your printer on Raspberry Pi if it is not already selected
  11. Go to the administration tab (required login and password root)
  12. Click on "find new printer.

    cups-2

  13. Select the printer you have connected. Home, It's an Epson Stylus SX218
  14. Change the information if necessary and select the option "Share this printer".
  15. Choose the brand and click "continue".
  16. Choose the model of the printer and click on "Add printer".
  17. Set your default print settings and click on "set default options.. Me for example I changed the paper size setting to default to A4.
  18. Voilà ! Your printer is installed. If you go to the tab “Printers” It will be in the list.

    cups-3

  19. You can now print a test page. For this, Click on the printer and then in the drop-down list “Maintenance” choose “Print test page”

    cups-4

  20. Now let's add the AirPrint support to our small machine. Thanks to TJFontaine, via a python script everything will happen automatically and facilitate the task.Retrieve the script :
    wget - No.-check-certificate https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py o /root/airprint-generate.py && chmod 700 /root/airprint - generate.py
  21. Home, the launch of the script gives the following error :
    /usr/bin/env: Python: No. such file or directory

    I therefore edited the script and changed the first line by replacing Python by python2

  22. Run the script by passing as parameter the directory where to install the service for avahi
    /root/airprint - generate.py-d/etc/avahi/services
  23. It is installed ! Now you have in/etc/avahi/services, a file that matches your printer :

    cups-5

  24. From an iOS device, by clicking on the share button, you have the line to print, you choose the printer that you just installed and you post.

    cups-6

  25. If you have a device with an iOS version 6.x may not be sufficient. The blog of mmornati explains here How to make.With the user root always, launch the 2 following commands :echoimage/urf urf (0,UNIRAST)" > /usr/share/cups/mime/apple.types

    echoimage/urf application/vnd.cups-postscript 66 pdftops" > /usr/share/cups/mime/local.convs

At home I was able to print from Mac OS using the AirPrint printer. The base printer sending me a message “Obtaining the impossible software”. Side Windows, need to add a network accessible from a URL like IPP printer.

You can play !

Like this article ? Bear with me on patreon!

You may also like...