Source: youtube.com

After my first Ubunutu Server install (Hardy Heron LTS 8.04), I couldn’t get the local printer setup. Here’s how I fixed it.

I’m a linux newbie and was feeling a bit lost without GUI. Several articles I read said gnome on a server was an unnecessary security risk, so I installed Webmin. But I couldn’t add the printer via Webmin Hardware -> Printers Administration. I kept getting the following error:

Failed to save printer: lpadmin failed :
lpadmin: No such file or directory

I have a brother MFC printer, so I first made sure the printer drivers where installed. I found info on the Ubuntu Brother MFC drivers and installed the package via Webmin System -> Software Packages. But trying to add the printer via Webmin still gave the same error.

I decided to try to install the printer another way, and found out that CUPS was likely the way to do it. I checked the package manager to make sure CUPS was installed. It was.

I then tried the CUPS web interface to see if I could install from there. But I couldn’t get to it. I found some CUPS documentation and realized that by default the CUPS server only listens to requests from localhost. So, I edited the etc/cups/cupsd.conf file:

  • comment out:
    #Listen localhost:631
  • add : (my server host name is “alexander”)
    Listen alexander:631
  • turn on browsing:
    Browsing On

I restarted the CUPS server

sudo /etc/init.d/cupsys restart

and and tried to connect to https://alexander.mydomain.com:631/, but I got a 403 Forbidden error.

After some searching, I discovered that I had change the blocks to add access from the local network. I add “Allow @LOCAL” lines to etc/cups/cupsd.conf file. Changed parts of the file noh now looked like this:

# Only listen for connections from the local machine.
# Listen localhost:631
Listen alexander:631  #added by Carl (alexander is the server's host name)
Listen /var/run/cups/cups.sock

# Show shared printers on the local network.
Browsing On  #turned on by Carl
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL

# Default authentication type, when authentication is required...
DefaultAuthType Basic

# Restrict access to the server...
<Location />
 Order allow,deny
 Allow localhost  #added by Carl
 Allow @LOCAL     #added by Carl
</Location>

# Restrict access to the admin pages...
<Location /admin>
 Order allow,deny
 Allow localhost  #added by Carl
 Allow @LOCAL     #added by Carl
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
 AuthType Default
 Require user @SYSTEM
 Order allow,deny
 Allow @LOCAL   #added by Carl
</Location>

Another CUPS server restart and… I was in! What a beautiful sight: the CUPS GUI.

Now life was good. I clicked “Add Printer,” walked through the GUI steps, and in about 60 seconds the printer was installed.

cha-ching!

Update for Ubuntu 10.04:

  • needed to add to cupsd.conf file:  ServerAlias *
  • For my Brother MFC 7420, I had to install: sudo apt-get install brother-cups-wrapper-laser

Update for Canon Printers (thanks Jay!)
Per Jay’s comment below, if you have a Canon printer, don’t use the default cups drivers. Download them from Cannon instead and you should be all set.