Most DIYers assume a print server is a challenge to set up or is at least a costly endeavor. You could take a Windows XP or 7 box, slap a printer on it, and share the printer out to the company, but that’s not a print server — it’s just a desktop sharing out a printer, and it will not handle the print jobs necessary for anything more than a few users. If you want to serve up more than just a few documents, you want a server doing the job.

We’ll be doing this with the help of Linux, Samba, and CUPS, so you won’t need the hardware that would be required for a Windows Server 2010 box. You won’t be running a GUI on top of anything, so most likely you have the necessary hardware sitting around. For this tutorial, I will assume you already have a Linux box set up.

Let’s use a Ubuntu Server platform to host our print server. You can use any flavor of Linux, but you’ll need to modify the instructions here to fit your needs. It’s time to get down to work.

Installing CUPS

Most likely your server already has CUPS installed and running; if not, this system is very easy to install. Open a terminal (or just log in to the console) and issue the command sudo apt-get install cups. This should pick up all necessary dependencies, as well as some of the other important CUPS bits (such as Gutenberg drivers).

Installing Samba

With Samba, you should issue the command sudo apt-get install samba. All dependencies should be picked up by that single command.

After the installation of both of the above tools, each daemon should already be started. For future reference, the starting of each can be done like so:

  • sudo service cups start
  • sudo service samba start

Now we’ll begin the actual setup of both of these services.

CUPS setup

If you’re working on a graphic desktop, you probably have a handy GUI tool to use to add your printer. If you’re on a console-only or headless server, you use the CUPS web-based administration tool. With this tool, you can easily add a new printer to you server. To access this tool, point a web browser to http://ADDRESS_TO_PRINT_SERVER:631. Once you’re on that page (Figure A), click the Add Printer button under Printers.
Figure A

You can manage every aspect of a CUPS server from this location.

After you complete the steps in Print Add wizard, make sure to run a test print to ensure the printer is actually printing; otherwise, the work you will do with Samba will be in vain.

Samba setup

Now we get into the nuts and bolts of setting up your print server. Believe it or not, unless you’re really getting into a complex print server, configuring Samba to serve up your printers isn’t difficult. Here’s how to share out printers so everyone can use them.

First, open the /etc/samba/smb.conf file in your favorite text editor (you’ll need admin privileges to save to this file). Once the file is open, look for these two sections:

comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no

The first section is the basic entry for sharing out printers with Samba. Let’s break this down:

  • [printers]: Name of the directive.
  • comment = All Printers: The human readable comment.
  • browseable = no: This controls whether this share is seen in the list of available shares in a net view and in the browse list. Set this to “yes” so users can see the listed printers.
  • path = /var/spool/samba: Path to the printer spool.
  • printable = yes: Set to “yes” to allow users to print.
  • guest ok = no: Set to “yes” to allow guest users (anyone) to print to the printer.
  • read only = yes: If set to “no” users will be able to create and modify files in the service’s directory.
  • create mask = 0700: How the “create file” permissions are handled.

For a print server that is going to allow all users (guests) to print to the configured CUPS printers, the only thing you would need to change in the above section is the “browseable” and “guest ok” entries.

The second print section shown below should include any necessary Windows drivers for downloading to clients.

comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no

The above section should be fine as is, but there might be one issue depending upon your setup: You have to copy all driver files into the directory configured above (in the sample it’s /var/lib/samba/printers/). If you don’t set “guest ok” to “yes,” users may have to have a Samba username and password in order gain access to the necessary files. If you cannot open that directory to everyone (by setting “guest ok” to “yes”), you might have to add users to Samba using the smbpasswd tool. If you have a lot of users, it might be best to open the floodgates. You can be safe and house those files in a location such as /opt/printdrivers/ and then set “guest ok” to “yes.”

After you make the changes in the smb.conf file, you need to restart Samba with the command sudo service samba restart. Now you should be serving up all printers attached to the printer server with the help of hardware you probably already had sitting around.