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!
- Machine Learning Everywhere
- Own Your DNS Data
- Bash Shell Script: Building a Better March Madness Bracket
- Understanding OpenStack's Success
- Simple Server Hardening
- Returning Values from Bash Functions
- Understanding Firewalld in Multi-Zone Configurations
- From vs. to + for Microsoft and Linux
- Natalie Rusk's Scratch Coding Cards (No Starch Press)
- Tech Tip: Really Simple HTTP Server with Python