RaspberryPI: Print server
The goal for this build was to create a print server for my Brother HL-110 and Dymo LabelWriter 450 that could be used by both Mac and Windows. It turned out to be more tricky then I expected! After some research, testing and re-installs I came up with a solution that worked. It involves compiling drivers, setting up CUPS and samba to get all the parts to work properly.
As usually I used Win32DiskImager to get Raspbian onto an SD-card. After that I added a blank file named ssh on the boot volume. That will enable ssh right away and eliminate the need for hooking up a monitor and keyboard just to enable it. Then boot up the raspberry pi and check your DHCP server/router for what IP-address it was assigned and SSH into it. First we want to make sure everything is up to date…
[bash]sudo apt-get update
sudo apt-get upgrade[/bash]
CUPS is an open source printing system developed by Apple for MacOS and other Linux based systems. It has full ARM support but the availability of the printer drivers may wary from manufacturer to manufacturer. If source code is provided you can compile the the drivers your self but if none is available you might end up using the same trick I did. Let’s install and configure CUPS.
[bash]sudo apt-get install cups cups-pdf[/bash]
Add the account pi to the lpadmin group.
[bash]sudo usermod -a -G lpadmin pi[/bash]
Then we need to edit the CUPS config file /etc/cups/cupsd.conf and remove the limitation that the admin interface is only accessible from localhost. Open up the config file:
[bash]sudo nano /etc/cups/cupsd.conf[/bash]
Replace the line:
This instructs CUPS to listen for any contact on any networking interface as long as it is directed at port 631.
Scroll further down in the config file until you see the “location” sections. Set it up to allow connections from the local network.
[bash]< Location / >
# Restrict access to the server…
< /Location >
< Location /admin >
# Restrict access to the admin pages…
< /Location >
< Location /admin/conf >
Require user @SYSTEM
# Restrict access to the configuration files…
< /Location >[/bash]
Now you can restart the cups service and browse to <pi_ip_address>:631 and you should see the CUPS interface. Next step is to add our printers. When writing this there is no pre-compiled Linux drivers available for my Dymo LabelWriter 450 or my Brother HL-1110 and I don’t expect it to be either.
Compile the Dymo LabelWriter 450 drivers
In the cups interface you can add the Dymo right away with a built in generic driver. This will not work for anything else then windows machines. Since windows installs it’s own drivers locally it doesn’t really matter what driver is installed or not on the CUPS server. It’s only a communication mechanism to the printer it self. Since I want to use the printers from both my windows and Mac computers I need the proper drivers where available. First we need to install dependencies for the compilation of the driver:
[bash]sudo apt-get install libcups2-dev libcupsimage2-dev g++[/bash]
Then we can download the Dymo CUPS drivers source code, unpack it and compile it:
[bash]wget ‘download.dymo.com/dymo/Software/Download Drivers/Linux/Download/dymo-cups-drivers-1.4.0.tar.gz’
tar xvf dymo-cups-drivers-1.4.0.tar.gz
sudo make install[/bash]
Now when we go to add the driver via the CUPS web interface the proper driver should show up. This will allow you to use the printer both from Mac, who will discover it over Bonjour, and windows. To add it in windows just navigate to the printer in the web interface and copy the url. The Add Printer wizard in windows will take that straight of and all you need to do is supply the proper windows drivers for the printer that you downloaded.
Workaround for the Brother HL-1110
As stated before the Brother HL-1110 works fine shared from CUPS on a windows machine since it installs it’s own drivers. I tested around for a bit with different drivers supplied with CUPS for different Brother printers with similar specs without success. I did find a deeply hidden file to download from brother with the source but it couldn’t be compiled straight of and gave me a lot of issues even when I thought I built it correctly.
Drivers for this printer is available for Linux but not for the ARM architecture. So it shouldn’t be a problem connecting to this printer from another Linux machine using local drivers, when I write this I haven’t tried it yet.
The Mac doesn’t allow you to add any other drivers when connecting to the printer over the Bonjour announced print share. So I installed samba on the pi and added the printer that way. Simple install:
[bash]sudo apt-get install samba[/bash]
I left all the settings as is and then browsed for a windows printer on my Mac. Found the workgroup and then printerpi (thought it was a proper name for this) and then added the printer. This way I got to specify the Mac drivers I wanted to use.
Not the perfect solution that I wanted. Just wanted a cheap printer for a project that required A4 and label printing so I just ordered the cheapest printers they had in stock. After this I would recommend you to check for a printer with proper drivers or proper source code available for Linux and the ARM architecture. It is a bit ironic that the open source solution developed by Apple works fine under any circumstance for my windows machines while samba or SMB who is much more common in the windows world sorts out my Mac issue.