Solved: FreeBSD as print server w/CUPS + samba + apsfilter
Mike
addymin at pacbell.net
Mon May 24 18:55:18 PDT 2004
Greetings:
This post is a result of 2 days of thrashing trying to get FreeBSD (4.9)
to act as a print server to Win2K/XP clients. I have included links to
a how-to that I wrote that includes a full install and configuration of
CUPS and Samba so that local (connected to server) printers print
locally, and so that that local printer(s) can then be shared (served)
as network printer amongst Windows 2k/XP clients.
My original post on 5/21/2004 "Network printing question: apsfilter +
samba over Win2k network" contained what I had accomplished, so far.
So... To make a long story short
I have apsfilter and CUPS and Samba installed and working.
The server prints to it's local (via parallel port) printer using either
apsfilter or cups.
Serving that locally connected printer over a Windows network (to
Win2k/XP clients) is accomplished with CUPS and Samba.
Here is the long version of the how-to:
http://www.ajl-tech.com/index.php?option=com_frontpage&Itemid=1
or
http://www.ajl-tech.com/index.php?option=content&task=view&id=16&Itemid=31
Here is the short version, illustrated as general procedure (with in
between steps removed). This how-to assumes that the printer in
question has a good driver available at www.linuxprinting.org.
Step 1. Install CUPS via ports and other apps + drivers
/usr/ports/print/cups
/usr/ports/print/gimp-print
/usr/ports/print/hpijs
/usr/ports/print/ghostscript-gnu
/usr/ports/lang/perl5
For each of the above: "make install clean"
Step 2. Get the proper driver (.ppd file) from www.linuxprinting.org and
copy it to the "/usr/local/share/cups/model" directory. For example:
chown root:wheel HP-LaserJet_4M-postscript.ppd
chmod 644 HP-LaserJet_4M-postscript.ppd
mv HP-LaserJet_4M-postscript.ppd /usr/local/share/cups/model
Step 3. Get Foomatic. You'll need the following 2 files:
http://www.linuxprinting.org/foomatic-rip
http://www.linuxprinting.org/foomatic-gswrapper
These files need to be moved to the right location with the right modes
applied:
mv foomatic-rip /usr/local/bin
mv foomatic-gswrapper /usr/local/bin
cd /usr/local/bin
chmod 755 foomatic-rip foomatic-gswrapper
Step 4. Make sure Foomatic can be reached by CUPS:
Place a link in CUPS's "filter" directory at
/usr/local/libexec/cups/filter: (note: the following is 1 line)
ln -s /usr/local/bin/foomatic-rip
/usr/local/libexec/cups/filter/foomatic-rip
Important!!
CUPS will have installed its own versions of the commands "LP" "lpr"
"lpq" "lprm" in the [/usr/local/bin] directory. While BSD installs its
own (original) versions of these commands in [/usr/bin]. For sharing
this a printer to others across a network via Samba, we'll need to make
sure to reference the CUPS version of “lp” “lpr” “lpq” and “lprm” (in
/usr/local/bin).
Step 5. Configure the printer
Start CUPS: "/usr/local/etc/rc.d/cups.sh start"
Bring up CUPS via browser: "http://localhost:631"
Supply "Name" "Location" and "Description". Then supply the printer
model (the downloaded .ppd driver should be there as a choice).
Print a test page. Congrats you should have local printing.
Step 6. Configure CUPS for network print service
Edit the "cupsd.conf" file. Make the following configs:
Set your "broadcast" option for the LAN by setting:
"BrowseAddress @LOCAL"
Set local access privileges, find the <Location /> section and:
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1.*
</Location>
This would allow anyone within the 192.168.1.* network to have access to
CUPS.
Step 7. Install Samba via ports & Configure Samba
cd /usr/ports/net/samba
su
Password: ********
make install clean
Start Samba: "/usr/local/etc/rc.d/samba.sh start"
Note: make sure these ports are open on the server's firewall (for
samba): port 139 (tcp), port 138 (udp), and port 137 (udp)
Modify the smb.conf file: Here is my working smb.conf file.
global]
workgroup = workgroup
printcap name = cups
log file = /var/log/log.%m
max log size = 50
socket options = TCP_NODELAY
netbios name = mango
dns proxy = no
load printers = yes
security = share
os level = 20
printing = cups
encrypt passwords = yes
server string = Samba Server
[hp4m]
printable = yes
comment = hp4m for local network
printer = hp4m
use client driver = yes
lprm command = /usr/local/bin/lprm P%p %j
print command = /usr/local/bin/lp -d %p -o raw %s; rm -f %s
lpq command = /usr/local/bin/lpq -P%p
path = /var/spool/samba
writeable = yes
public = yes
Make sure that the “guest” user (nobody) is given access to the
/var/spool/samba directory.
Also notice that the “lp”, “lprm”, and the “print” command reference the
path to the CUPS versions of those commands. I found this to be
important. Referencing the FreeBSD (default) print commands will not get
the job done!
Another important entry is the “use client driver = yes”. If you don't
include this setting, Windows 2000/XP clients will be able to print to
the network hosted printer (HP4M), but they will complain about the
“printer not being accessible”.
Well I hope this how-to is useful and will help others who have plans of
replacing Windows 2000 servers with something "a little more durable".
I'm tired now but I've got a working print server. It's time to buy
beer and contemplate the universe...
Regards,
Michael Chinn
More information about the freebsd-questions
mailing list