In my last post I mentioned that I completed the migration of this blog from the old host machine (called imladris) to WordPress.com. This is part of a larger effort to retire that machine altogether. It had been hosting my blog, my photoblog, our family photo gallery, and my wife’s old blog for years. In addition, for the last few months I’ve been running a CUPS server on it so we could easily use our printer from any of our machines (we have 4 computers in the house, not including imladris). However, last night I pulled the plug on imladris. So, if we want to have our printer on the network again, I either need to buy a dedicated print server or I need to install CUPS on a different machine. Fortunately, we have another Linux machine in the apartment: orthanc, which I use as my MythTV machine.
I had installed CUPS on imladris only a few months ago, so the process should still be fresh in my mind. However, imladris ran Ubuntu 6.06 LTS, whereas orthanc runs Ubuntu 9.04. I’m not exactly sure whether 3 years* has made much of a difference but I’m going to try to follow online explanations to get it working. As I work on this, I’m just going to give an account of what I’m doing, where I found instructions, etc. until I get it working. If you’re interested in this, read on. If you’re not, maybe you can find a more entertaining way to spend your time, like playing Canabalt.
Last night I disconnected the printer from imladris and connected it up to orthanc. I also installed CUPS using the following command:
$ sudo apt-get install cupsys cupsys-client
I don’t actually know what the cupsys-client package does or whether I need it at all. Looking around at the Ubuntu package repository, it appears that cupsys provides the daemon and cupsys-client provides client software for the local machine. Thus, since I don’t care about being able to print from orthanc itself, I probably don’t need cupsys-client. Oh well.
Ok, so I’ve got the printer connected and CUPS installed. What now? I recall from the last time I installed CUPS, using the web interface was pretty easy. So, let me try to get that set up. First, I tried to simply enter what I thought was the correct URL and I got nothing. So, I did a quick search online. This site suggests editing
/etc/cups/cupsd.conf and replacing the following line:
I made this change and restarted CUPS by typing:
$ sudo /etc/init.d/cups restart
When I did this, rather than getting nothing when I pointed my browser to
that same URL, I got
403 Forbidden. So, that’s a start. At least the web server is returning something.
Up to this point I had been working remotely on my laptop using the command line via PuTTY. I was doing this because I don’t have a high resolution monitor attached to my MythTV machine; it’s only connected to my TV. However, I decided that using the browser locally might make things easier.
So, I shut down the MythTV frontend on orthanc and opened up Firefox. I pointed it to
http://localhost:631, at which point I was greeted by the CUPS administration page. Hooray! Using the CUPS administration page I searched for detectable printers. It detected my printer (HP LaserJet 6MP – old school, I know) and allowed me to add it. I could then pick the driver I wanted. On imladris I had used the Gutenprint driver. However, this time around there was a postscript driver available, so I chose that. I don’t know if it’ll be better than the Gutenprint driver – only time will tell. I printed a test page from the adminstration site and it came out very nicely.
So, it appears to work locally. Now, I need to knuckle down and actually figure out how to access the CUPS server remotely. To figure this out, I consulted the official documentation for
Basically, I was able to figure out that I needed to change something in the following code block:
This governs access to the main part of the server. There are separate, more restrictive blocks for the admin and config sections of the server. For now, I’m not going to worry about being able to access the administrative or configuration functions remotely.
From the documentation, I found that
Order allow,deny rejects requests by default then applies additional rules starting with
allow lines first, followed by
deny lines. The other order, namely
Order deny,allow accepts requests by default then applies rules specified in any
deny lines followed by rules in any
allow lines. I don’t really understand this fully because I tried a few things that didn’t have the results I expected. However, for now, changing the original block of code above to the following got things working:
I think that with this configuration, anyone in the world could print on my printer. That’s probably not a great situation. However, I think it may have been the situation with my CUPS installation on imladris as well. I never had any problems with it, so hopefully, I won’t have any problems with this new installation.
Ok, so now I can access the CUPS server from my laptop and presumably any other computer. The last step is installing the printer on each computer I want to be able to print from. I started with my laptop. I did a quick search to see how I should do it. I came across this site and tried their recommendation, which is to install the printer as a local printer using a new local port. However, when I tried to enter the URL of my printer, it told me it was an invalid port name. So, I looked around a little more and found this site. They recommend setting it up as a network printer. I tried this and it worked! I chose the appropriate driver and printed out a test page. Sweet.
Now, I just have to install this printer on our other two Windows machines and we’re all set. It actually didn’t take very long to get this all set up. Like I said, the CUPS configuration might not be the most robust but I think it’ll get the job done for now.
If anyone reading this has any suggestions for a more robust
cupsd.conf setup, please leave me a note in the comments. Thanks!
*For the uninitiated, Canonical releases a new version of Ubuntu every 6 months. Recently, these versions have been released in April and October. The version numbers use the year and month of release. So, 6.06 means it was released in June of 2006, where 9.04 means it was release in April of 2009. Each release is also named after an animal preceded by an adjective beginning with the same letter as the animal’s name. These names have progressed in alphabetical order since 6.06 (Dapper Drake). 9.04 is called Jaunty Jackalope, while the upcoming version will be called Karmic Koala. The next long-term support (LTS) release will be 10.04, called Lucid Lynx.