lpd: Getting the Hard Copy
Now that you have your printer set up for yourself, you might want to consider sharing it with the rest of the network. There are a few ways of doing this. With other UNIX or Linux machines with BSD-styled print systems, just follow the directions in the previous section, and you'll be off and running. Pay attention to the specified network configuration line.
The most likely scenario, however, is one Linux machine sharing its printer or printers with one or more Windows machines. To do this, you're going to want to use Samba, the SMB implementation for UNIX, which runs quite well on Linux. After you have finished setting up the printers, install Samba on the Linux machine. Samba is available at http://www.samba.org/ and is open-source software as well.
Read through the Samba documentation to get it installed. It's a quick install, but it does require some editing of configuration files. For those of you who are impatient, here's a simple configuration file to use (locate it at /usr/local/samba/lib/smb.conf):
[global] remote announce = 192.168.1.255 interfaces = 192.168.1.1/255.255.255.0 netbios name = your_computer_name workgroup = your_workgroup_name printing = bsd security = share [public] comment = Public Stuff path = /tmp public = yes writable = yes
This will export one share for use on the network, named “public”. If you have the Win95 machines set up with the same parameters, you should be able to browse the public share and look through all of its subdirectories.
Once that is done, you're ready to add the printer. The printer is added to the config file in the following manner:
[printername] path = / printer name = writable = yes public = yes printable = yes print command = lpr -Pprintername %s; rm %s
Replace printer_spool_dir with the printer's spool directory (I just use /tmp, but you can use /var/spool/lpd/ if you wish) and printername with the name of your printer (I just used hp).
At this point, restart Samba:
killall -HUP nmbd; killall -HUP smbd
Make sure you can still browse files across the network. This time, you should see a printer icon with the assigned name from the Samba configuration file.
On the Win95 clients, it would be best to install a generic PostScript printer. Then all your Win95 programs will output PostScript, and the printer filter on your Linux server will be able to both spool and print your documents as if they were local documents. To add a network printer in Win95, select the “Network” option when the Add Printer script prompts you. However, this approach doesn't always work, and you might want to use a more crude way of printing by changing the print command line in the above config file snippet to the following:
print command = cat %s > /dev/lp1; rm %s
Replace /dev/lp1 with the device to which your printer is attached. After you have replaced that line, re-install the printer on your Win95 box as the actual type; i.e., if you have a LaserJet 4L, install it as a LaserJet 4L in Win95. Note that with this method, no print spooling will take place on the Linux machine.
I hope this tutorial has helped you set up printing services in Linux. If you're fortunate enough to have a network in your home or office, you should also be able to set up the printer in question for use on the network by other computers. If you're still having trouble printing, you can check out the Linux Printing-HOWTO located at metalab.unc.edu/LDP/HOWTO/Printing-HOWTO.html. Good luck!
- Readers' Choice Awards 2013
- IBM Will Minimize Impact of Future Disasters
- December 2013 Issue of Linux Journal: Readers' Choice
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Tech Tip: Really Simple HTTP Server with Python
- Linux Systems Administrator
- Senior Perl Developer
- New Products
1 hour 15 min ago
- yes it's Jupiter Broadcasting
2 hours 34 min ago
- nice to see PClinuxOS finally
5 hours 8 min ago
- Personally, I am no longer a
6 hours 5 min ago
- Reply to comment | Linux Journal
19 hours 30 min ago
- It's Jupiter
20 hours 29 min ago
- GIMP is certainly a graphic
21 hours 31 min ago
- Thanks For Your Sharing
1 day 2 hours ago
- Studying linux, and looking
1 day 5 hours ago
- voting for Best Linux Distribution
1 day 14 hours ago