From FreeBSDwiki
Jump to: navigation, search

CUPS (Common Unix Printing System) This makes it easy to add printers to your system and programs such as firefox will pick up the printer list automatically.


Installing CUPS

Make sure CUPS supports your printer, which normally are HP printers.

To install:

# pkg_add -r cups


# cd /usr/ports/print/cups
# make install clean

The CUPS daemon can now be started.

# export cupsd_enable="YES"
# /usr/local/etc/rc.d/cupsd start

If you want CUPS to start at boot time, add the line cupsd_enable="YES" to /etc/rc.conf. The Cups configuration file is at /usr/local/etc/cups/cupsd.conf.

Note that the port installed by sysinstall (for FreeBSD 6.2 at least) is cups-base and much functionality is missing so you may want to add the above port even if you installed cups when you installed FreeBSD. As well, cups-base (and perhaps cups) does not create a directory for CUPS log files. They can be very handy for debugging so create one this way:

# mkdir /var/log/cups

Install a Parallel Printer

If you use an old parallel printer then you need to do the following before you add the printer through cups:

# chown root:cups /dev/lpt0
# chmod 0660 /dev/lpt0

Now add these lines to /etc/devfs.conf so that the permissions are set during boot time

own    /dev/lpt0    root:cups
perm   /dev/lpt0    0660

Turn on your printer and let it boot up. You should also make sure that it is "On Line". Now go back into the cups setup http://localhost:631 and add your printer, you will notice that there is now a Parallel device present.

After installing a printer try printing a test page. If you are using a non-Postscript printer you may get the error:

Unsupported format 'application/postscript'

In this case, add the port cups-pstoraster or the cups meta-port.

# pkg_add -r cups-pstoraster


# pkg_add -r cups

Now open /usr/local/etc/cups/mime.convs in an editor as root and add or uncomment the line linking pstoraster to the mime type application/postscript.

application/vnd.cups-postscript application/vnd.cups-raster     100     pstoraster

Restart the cups daemon

# /usr/local/etc/rc.d/cupsd restart

and try to print a test page.

Installing a PCL printer

If you have a printer which handles PCL but not PS then you need to install the 'hpijs' port

# portinstall -P hpijs

Now you will have a huge list of HP printers to select from, if you have a basic B&W laser printer which accepts PCL then use the 'HP LaserJet 5L Foomatic/hpijs' driver and you shouldn't have a problem.

Printing from Windows XP to a FreeBSD CUPs server

You don't require samba to print from an XP client through a FreeBSD CUPS server to your printer. It's easier to do this without samba actually. It doesn't matter if you have samba installed though.

Simply get your printers working under CUPs and on the local server and test these. Then on the windows box add a new network printer and point that printer to your server by using the URL section of the wizard.

For example

http://<server>:631/printers/<printer name>

Then you will be able to have full rights of that printer on each windows box.

KDE Setup

You can setup any non KDE applications such as Openoffice to use the KDE printer dialogue by setting up the default printer of that applications as:

kprinter -stdin


Change the default printer in openoffice spadmin program


Add the following to /usr/X11R6/etc/xpdfrc config file.

psFile                  "|kprinter -stdin"


CUPS can also be used to print directly from any program to a PDF file.

# pkg_add -r cups-pdf

CUPS mimics lpr

If you have old programs which use lpr to print then you should install CUPS-lpr

# pkg_add -r cups-lpr

Accessing and configuring

Type or http://localhost:631 into your browser. Here you can configure your printers and printing status.


CUPS with proxy

Make sure if you run a proxy to set localhost in the exceptions of your browser. It should now be able to connect to http://localhost:631

CUPS and KDE Error

If you get an error in KDE print manager such as: cups host not found.

Then change the host from host: /var/run/cups.sock to host: localhost

CUPS and Gnome Warning

In order to have CUPS work with Gnome applications and Firefox3, you will need to add 'WITH_CUPS="YES"' to your /etc/make.conf and recompile libgnomeprint and gtk20. You can do that with the commands:

# echo 'WITH_CUPS="YES"' >> /etc/make.conf
# cd /usr/ports/print/libgnomeprint && make deinstall && make configure && make install
# cd /usr/ports/x11-toolkits/gtk20 && make deinstall && make configure && make install
Personal tools