CUPS (Common UNIX Printing System) – installation and configuration
Well I am no article writer, but I decided to write down the steps I took to setup up a usb printer
(HP DeskJet 640C) to a FreeBSD Server, and to be able to print from another
FreeBSD workstation running KDE or Windows 2k/XP workstation from within my LAN.
At first I tried an apsfilter/LPRng combo, but couldn’t get past the test page.
So I turned to CUPS. Their online manual, seemed pretty complete,
so if you run into any problems, check out the manual first.
I am going to assume Samba is installed and working.
Take a deep breath….
- Build a new kernel with usb/printer support on both server and workstation.
Note: GENERIC kernel config files should already have these options.# USB Stuff device usb device uhci device ulpt
Note: To determine whether you need device uhci or device ohci try checking
dmesg
:hivemind# dmesg | grep uhub uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
- Edit
/etc/rc.conf
and add if its not already there ->usbd_enable="YES"
Make sure the device node ulpt0 exists under
/dev
. If not, create it.cd /dev && ./MAKEDEV ulpt0
- Reboot for the new kernel and
rc.conf
changes to take effect. - ON SERVER: Edit
/etc/make.conf
and addWITHOUT_X11=yes
- Install ghostscript
cd /usr/ports/print/ghostscript-gnu && make install distclean
Note: During my setup, I didn’t modify
/etc/make.conf
. I just
installed /usr/ports/print/ghostscript-gnu-nox11.
I was told that settingWITHOUT_X11=yes
would be an alternative if x11 isn’t desired on the server,
which/usr/ports/print/ghostscript-gnu
tries to install. - ON WORKSTATION: Install ghostscript
cd /usr/ports/print/ghostscript-gnu && make install distclean
- Install CUPS
cd /usr/ports/print/cups && make install distclean
- Move
/usr/local/bin
*before*/usr/bin
in all user’s path that will be using CUPS.
It depends on what shell each particular user is using.
For example. On the server, I edited root’s path in/root/.profile
On my workstation, I edited my shell (tcsh)~/.tcshrc
You will have to log out and log back in for the changes to take effect. - Copy
cupsd.sh.sample
tocupsd.sh
cp /usr/local/etc/rc.d/cups.sh.sample /usr/local/etc/rc.d/cups.sh
- CUPS can be administered via a web browser. By default, CUPS is looking for web admin
requests from localhost.
So on the server, I edited/usr/local/etc/cups/cupsd.conf
and changed 127.0.0.1 to the
ip address for my workstation in 2 places. - Uncomment
application/octet-stream
in/usr/local/etc/cups/mime.types
and/usr/local/etc/cups/mime.convs
- Uncomment
BrowseAddress @LOCAL
in/usr/local/etc/cups/cupsd.conf
- Start CUPS
/usr/local/etc/rc.d/cupsd.sh start
- Check for running CUPS
hivemind# ps aux | grep cupsd
root 183 0.0 0.8 3852 3048 ?? Ss Mon04PM 0:15.05 /usr/local/sbin/cupsd
root 9838 0.0 0.1 1068 540 p0 S+ 7:29PM 0:00.00 grep cupsd - Browse to your server’s web admin, Add Printer, and follow the directions.
http://your_server_name_or_ip:631/admin/
I used USB Printer #1 in my case. - Browse to your workstation, Manage Printers. If all went well in the preceding steps, the printer on the server should be automatically configured on the workstation.
http://localhost:631/admin/
If there are no printers setup, click Add Printer and use Internet Printing Protocol. ipp://server_hostname_or_ip/ipp/ - Print a test page. If all went well, you should be able to print from your FreeBSD
server via the command line and workstation via the command line and/or KDE/mozilla/etc without any problems now.gladiator# echo This is a test > ~/test_page.txt gladiator# lpr ~/test_page.txt
To be able to get windows computers in the mix, you need Samba installed on the server.
Then edit /usr/local/etc/smb.conf
-
Add to the [global] section:
printcap name = cups printing = cups
-
Add a printer section
[Printer] comment = Network Printer path = /var/spool/samba guest ok = Yes printable = Yes
Restart Samba and your windows boxes should see the printer.
Install the printer driver for windows, and you should be set.