Sunday, May 4, 2008

Setting up a printing server with CUPS

This How-To will make you install a printer and share it through http/ipp (Internet Printer Protocol) protocol

Install CUPS Common UNIX Printing System:
$ apt-get install cupsys

Add a printer:

To add a printer there are two ways:

* From the Shell:
The command to add a printer is:
$ lpadmin -p printer -E -v device -m ppd

an example:
$ lpadmin -p Laserjet -E -v socket://11.22.33.44 -m laserjet.ppd

* Through CUPS webmin:
Open an Internet browser (Opera, FireFox, Konqueror..etc etc) and type the address http://localhost:631 or http://127.0.0.1:631, enter root and the correspondent Password.
Click on Add Printer button and enter the requested parameters.

Now you have the printer installed. If you didn't find the driver try installing Gimp-print Printer Drivers and restart the server.
$ apt-get install cupsys-driver-gimpprint
$ /etc/init.d/cupsys restart

Share the printer so the other users can use it to print: with a text editor (gedit, nano, vi etc etc) open the configuration file (/etc/cups/cupsd.conf) and add at the end:
< Location /printers/printer-name >
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
AuthType Authorization kind
Allow from network
< /Location >

Example: You have a printer named FS1000, and four computer with 192.168.0.x IPs and 255.255.255.0 as a subnetmask and you don't want the computer to ask for any identification in order to use the printer, so add the following lines in the configuration file:
< Location /printers/FS1000 >
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
AuthType None
Allow from 192.168.0.0/255.255.255.0
< /Location >

You will find the other parameters for the file customization inside the file itself.

How to set up the various clients:

* GNU Linux/Unix
A machine with GNU Linux/Unix must have CUPS installed too: Open the Internet browser, enter http://localhost:631 or http://127.0.0.1:631 log in as root in the CUPS administration panel and press the add printer button.
Enter Name, Location and Description.
Select Internet Printer Protocol (http)
and insert the device's Url
http://computer_ip:631/printers/shared_printer_name
example: http://192.168.0.1:631/printers/FS1000
Select Raw and Raw Queue as printer's drivers, or the printer's one.
* Microsoft Windows XP e 2k
Click on Start-->Impostazioni-->Stampanti e Fax
Click on "Add printer" inside the menu about "Printer operations".
Select "Network Printer or printer connected to another computer".
Select "Connect to a printer in Internet or in the domestic/business network".
and enter the URL
http://computer_ip:631/printers/shared_printer_name
example: http://192.168.0.1:631/printers/FS1000
Select the Driver and complete.

No comments: