CUPS

Robert Storey y2kbug at ms25.hinet.net
Sat May 15 12:36:28 UTC 2004


Dear All,

This is my first submission to this list, so bear with me if I'm not following
the right protocols, or whatever.

The Manual has very little useful information about CUPS. There is a brief
introduction to CUPS and readers are referred to www.cups.org.

I've written up a little HOW-TO for getting CUPS and up and running, and I'd
happy if it got appended to the current CUPS introduction in the Manual. So
without further ado, below is what I've written. I'd appreciate any feedback.

best regards,
Robert

==============================================================


STEP 1: For those who rebuild world every now and then, it might be best to add
this to /etc/make.conf before building world and installing CUPS:

   CUPS_OVERWRITE_BASE=yes
   NO_LPR=yes

However, the above is not mandatory.


STEP 2: Installing CUPS from PORTS

You've got to install four packages from ports. You can find them here:
 
   /usr/ports/print/cups
   /usr/ports/print/cups-base
   /usr/ports/print/cups-lpr
   /usr/ports/print/cups-pstoraster

The first port - /usr/ports/print/cups - is a meta-port, so installing it should
install the others.
 
 
STEP 3: Creating a Log Directory

Create a directory for the CUPS log files:
 
   mkdir /var/log/cups
 
 
STEP 4: FreeBSD-specific Issue

On FreeBSD, CUPS stores its executable files in /usr/local/bin/ whereas the
traditional lp executables are in /usr/bin/. Because /usr/bin/ is in the command
path before /usr/local/bin/, your CUPS files will not be able to execute. For
example:
 
   # which lpr
   /usr/bin/lpr
 
This problem is handily solved by making file /usr/bin/lp* non-executable, like
this:
 
   chmod -x /usr/bin/lp*
 
Now, try the previous command again:
 
   # which lpr
   /usr/local/bin/lpr
 
Success! This is what we want.


STEP 5: Starting the CUPS Daemon
You need to set up a script that starts the CUPS daemon on bootup. There is a
sample startup script which you can just copy and make executable, like this:
 
   cd /usr/local/etc/rc.d
   cp cups.sh.sample cups.sh
   chmod 755 cups.sh
 
The daemon will start automatically next time you reboot, but you it's easy to
start, stop and restart the daemon manually:
 
   # /usr/local/etc/rc.d/cups.sh
   Usage: cups {reload|restart|start|status|stop}

The daemon must be started before you can configure or use the printing.

 
STEP 6: Configuring the Printer

This part is just like Linux. Open up a browser (Mozilla or Konqueror will do)
and type this url:
 
   http://localhost:631
 
This will bring you to the CUPS configuration menu. You'll be asked to login
(login as root and use the root password), then it's simple point-and-click
operation that you should be able to figure out yourself.
 

STEP 7: Configuring a CUPS Server and Client

If you want to enable network printing on your LAN, you've got a little more
work to do. Assuming that the FreeBSD box is the print server, edit file
/usr/local/etc/cups/cupsd.conf and make two changes. The two changes vary
according to how your network is configured, but for a typical Class C network,
this should work:


  # broadcast address
  BrowseAddress @LOCAL

  <Location />
  Allow From 192.168.0.0/24


Instead of @LOCAL, we could have specified a broadcast address, such as
192.168.0.255 (again, that's for a Class C network). And rather than
192.168.0.0/24 (the whole network), we could have specified just a single client
machine (such as 192.168.0.3).

Once you have made the above changes, restart the CUPS daemon:

     /usr/local/etc/rc.d/cups.sh restart

Now go to the client machine, open your browser, type http://localhost:631, and
click the button "Print test page" - it should work.

Now try printing a regular html file with the same browser. It will probably NOT
work unless you remember to specify the CUPS server as the printer (if your
browser gives you an option to select a printer). For example, if use Konqueror
as your browser, you'd find the option under "Location-Print-Print - choose
"CUPS (common UNIX Print System)", rather than "Generic UNIX LPD Print System
(default)".

KDE apps (Kwrite, Kedit, Kspread, etc) are all very CUPS-network aware, and will
give the option to use CUPS network printing in the "File-Print" menu.







More information about the freebsd-doc mailing list