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 | grep avahi ps-ef | 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 !

You may also like...

  • mmornati

    Doc really detailed configuration. Compared with what it says on my blog (mmornati), I have not yet tested with the latest version of iOS (in fact I configured it but I never use it from my phone :p). My with the comment I understand it works!

    Marco

  • Crapsy

    Hello and firstly thanks for this wonderful tutorial.

    I would like to know if it is possible to make the same manipulation in having installed raspian and not ArchLinux ?

    Thanks in advance

    Crapsy

    • Hello
      I have not tried but I do not see what might not work because cups and avahi are under Raspbian. Ditto for python that is used for the generation of configuration script (at worst to do manually)

      • Crapsy

        Agree and thank you for your speed !

        Nice day

  • Halukard

    Hello,

    I have a problem trying to retrieve scripts :

    error: Failed retrieving file ' initscripts - 2012.10.1 - 1 - any.pkg.tar.xz’ from mirror.archlinuxarm.org : Could not resolve host: (Nile); Name or service not known

    There is a repo to use in particular?

    Thank you for your help

    • Halukard

      I got it in fact, I came across a forum or someone explained the need to make a pacman - Suy has each time rather than s. I do not know the difference (It seems to me that ca resynchronizes mirrors or style…) If you have an answer to why I'm interested ^^

  • Halukard

    I have a question (yet), Since I have installed nginx I can't connect to the web manager of cups by the port 631. Should I define a rule in etc/nginx/sites-enabled / to redirect port 631 (and by clarifying the root to cups) or is that there is another method?

    Thank you

    • Hello,
      My Nginx does not support the CUPS web interface that has its own web server. Suddenly no conflict. But it may be not optimal.

      • Halukard

        Well actually I followed the tutorial for cups I had properly access the web interface and as soon as I installed nginx I no longer had access (error in the browser, page not found). Suddenly I wonder about my setup nginx (I installed by following the tutorial)

        I would try to do a shot tonight or tomorrow at this time I did not have bp's time to concentrate on the worries.

        • And if you savegames Nginx then raises CUPS ?

      • Halukard

        I had a little time to watch, apparently avahi kidding. systemctl status avahi gives me :

        avahi.service

        Loaded: error (Reason: No. such file or directory)

        Active: inactive (dead)

        I try to reinstall, to launch the daemon but I have the impression that this doesnt… (the install is going correctly yet)

        • It could not come from the contents of your configuration file ?

      • Halukard

        It's good I got it, I had two problems. avahi was not launched and for nginx config file was not good either. Il me reste pas rajouter mes imprimantes 🙂

        Thanks for the tutorials yet

        • Good news ! Good continuation

  • Halukard

    One more question about cups and sharing printers on windows. One of mine is a multifunction but when I add the printer in cups or in windows I have that function available printer, the scanner function is not available. Is there a solution to recognize the capabilities of my printer? (with a DDP file? I did not understand exactly what it was)

  • Hi, many thanks for putting this up. I have just got a rasberry pi and I am having lots of fun playing with is. Could someone tell me how I can complete step 4: get the daemons running. I am new to arch os and I cant quite figure how I can get the daemons running so that I can move on to the next step and print from my ipad!

    Any pointers would be much appreciated… thanks again.

    • Hi,
      Should be in the file called rc.conf in folder/etc if i remember good (not using Arch Linux anymore 😉 )

Support Me !: Hi! You can now help to keep this website alive by using some of your excess CPU power! You can stop if you need! Soon it will be a ad-free website ;-)
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H/s)
OK + - Stop