Installing CUPS as Printing Server for FreeBSD

Home / Installing CUPS as Printing Server for FreeBSD

In this article we will discuss about how to install CUPS on FreeBSD. In this article I use:

  1. FreeBSD 8.3
  2. Updated ports collection.
  3. Supported parallel or USB Printer

What is CUPS?

The Common Unix Printing System (CUPS) is an open source printing system that provides a common interface to support printers in Unix-based systems. It also provides a standardized and modular platform that allows the use of external filters like Foomatic and Ghostscript for expanded printer compatibility. CUPS is licensed under the GNU GPL and has become the standard printing system for a large number of Linux distributions as well as Mac OS X.

CUPS is composed of a print spooler, filters, and backends. It uses the Internet Printing Protocol (IPP) to accept print jobs from clients on the network. The print data is then stored in a print spool or queue until the printer is ready to accept a print job. When the printer is ready, CUPS sends the print job through filters that convert the print job data into a language the printer understands. The converted data then travels through a backend to the intended printer. Common backends include Universal Serial Bus (USB) and parallel interfaces.

Most printers communicate using either PostScript or Printer Control Language (PCL). PostScript was developed at Adobe Systems in the mid-1980s to create a standard language for both document exchange and printer communication. CUPS can print to virtually all printers that support PostScript. However, PostScript printers are notoriously expensive due to the cost of licensing the technology from Adobe. PCL was created by Hewlett-Packard in 1984 and didn’t carry the licensing restrictions of PostScript. This has created a large market of low cost PCL printers. To support this large market, projects like Gimp-Print were started to develop Unix drivers for PCL printers. HP has responded to the need for Unix-based drivers with the Hewlett-Packard Inkjet Driver Project. Gimp-Print and the HP Inkjet Driver Project greatly expand CUPS support for non-PostScript printers.


Installing CUPS is as easy as installing other ports. You can enter following commands to complete installation (use root privileges):

setenv XORG_UPGRADE yes
cd /usr/ports/print/cups
make config ; make install clean

Here we use basic / defaults options so we don’t need to change anything.


Once the installation process is complete, it’s time to configure CUPS for use on our system.

FreeBSD includes a print spooling system that utilizes the same command names as CUPS. If the search path has not been modified from its default, the FreeBSD spooler will run instead of CUPS.  Therefore we need to tell FreeBSD to use CUPS instead of its print spooler. We also need to tell make command to skip compilation of the print spooler if we choose to recompile the base operating system and consider CUPS as drop-in replacement for the FreeBSD print spooler.

Edit /etc/make.conf and add following:

cp /etc/make.conf /etc/make.conf
echo 'NO_LPR="YES"' >> /etc/make.conf

In order to allow print clients to send raw print data to the connected printer we must uncomment a line in the /usr/local/etc/cups/mime.convs file. Scroll down to the application/octet-stream declaration and remove the hash mark (#) to uncomment the line. It should now appear as follows:

application/octet-stream   application/vnd.cups-raw     0     -

Save and exit.

We are now ready to modify the main configuration file, /usr/local/etc/cups/cupsd.conf. Now change the Listen localhost:631 declaration to Listen *:631. This allows external clients access to the CUPS web administration page. Otherwise, CUPS only serve localhost (serves self only).

By default, access to CUPS services is restricted and needs to be relaxed to enable printing support to computers on the local network. Change the Allow localhost declaration within the Location / container to Allow @LOCAL. The line should appear as follows after the modification:

# Restrict access to the server...
<Location />
   Oder allow,deny
   Allow @LOCAL

By default, access to the administrative web interface is closed to the local network and can only be accessed from the server itself. To allow access from the local network, change the Allow localhost declaration within the Location /admin container to Allow @LOCAL. You should also add Require user @SYSTEM to require authentication for access to the web administration page. The lines should appear as follows after the modification:

# Restrict access to the admin pages..
<Location /admin>
   Encryption Required
   Require user @SYSTEM
   Order allow,deny
   Allow @LOCAL

Note: The root account and users that are members of the wheel group will be able to log in to the web administration page at (substitute with your server’s hostname or IP address) to manage printers and print jobs. CUPS will encrypt authentication credentials using a self-signed certificate. We can also specify our own SSL Certificate.

Autostart at Boot

To automatically start CUPS on booting, make sure cupsd is enabled in /etc/rc.conf. You invoke following command to do so:

echo 'cupsd_enable="YES"' >> /etc/rc.conf

Save and exit. Enjoy


About Author

about author


A man who is obsessed to low level technology.

1 Comment
  1. Using CUPS - Xathrya.ID

    […] previous article, we have discussed about how to install CUPS on FreeBSD. In this article we will discuss and use the server for printing example […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial