How to Configure Automatic Printer Driver Download by Integrating CUPS and SAMBA
Novell Cool Solutions: Feature
By Maer Melo
Digg This -
Posted: 5 Apr 2007
This AppNote describes how to integrate CUPS with the SAMBA service to provide an easy and reliable print service for your network environment.
SAMBA is an open source suite that has, since 1992, provided file and print services to all manner of SMB/CIFS clients, including the numerous versions of Microsoft Windows operating systems. Samba is freely available under the GNU General Public License. For Linux, there are two daemons for Samba server: smnd for SMB/CIFS services and nmbd for naming services.
CUPS is a modularised computer printing system for Unix-like operating systems that allows computers to act as powerful print servers. A computer running CUPS is a host which can accept print jobs from client computers, process them, and send them to the appropriate printer.
To perform this integration, you will need to install the following packages:
- Edit the file /etc/samba/smb.conf and change the following settings:
[global] load printers = yes printing = cups printcap name = cups [printers] comment = All Printers path = /var/tmp browseable = no public = yes guest ok = yes writable = no printable = yes [print$] comment = Printer Drivers path = /etc/samba/drivers browseable = yes guest ok = no read only = yes write list = root
- You need to reload your samba service, using the following command:
- In this next step we will copy the Adobe Postscript driver files to the CUPS data directory /usr/share/cups/drivers. For licensing reasons, you will need to download this driver directly from the Adobe website | http://www.adobe.com/support/downloads/detail.jsp?ftpID=1500 (Adobe Universal PostScript Windows Driver). The files needs to be copied using UPPERCASE filenames:
ADFONTS.MFM ADOBEPS4.DRV ADOBEPS4.HLP ADOBEPS5.DLL ADOBEPSU.DLL ADOBEPSU.HLP DEFPRTR2.PPD ICONLIB.DLL PSMON.DLL -------------- LS command listing the files -------------- sles10:/usr/share/cups/drivers # ls . .. ADFONTS.MFM ADOBEPS4.DRV ADOBEPS4.HLP ADOBEPS5.DLL ADOBEPSU.DLL ADOBEPSU.HLP DEFPRTR2.PPD ICONLIB.DLL PSMON.DLL ----------------------------------------------------------
- After you setup a printer within CUPS through the available methods (lpadmin command, CUPS portal or YaST), you will use the command cupsaddsmb to set the driver files for client automatically download and installation after the first one contact with this printer share. The cupsaddsmb is a script that copies the needed files for convenient Windows client installations from the CUPS data directory to the [print$] share. Also, it copies the PPD files associated with this printer from /etc/cups/ppd to the [print$] share.
# cupsaddsmb -v <cups printer name>
sles10:/ # cupsaddsmb -v HP4050
Password for root required to access localhost via SAMBA: Running command: smbclient //localhost/print\$ -N -U'root%novell' -c 'mkdir W32X86;put /var/spool/cups/tmp/45f97eeb64ea2 W32X86/HP4050.PPD;put /usr/share/cups/drivers/ADOBEPS5.DLL W32X86/ADOBEPS5.DLL;put /usr/share/cups/drivers/ADOBEPSU.DLL W32X86/ADOBEPSU.DLL;put /usr/share/cups/drivers/ADOBEPSU.HLP W32X86/ADOBEPSU.HLP' Domain=[GW7LX] OS=[Unix] Server=[Samba 3.0.20b-3.15-1162-SUSE] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86 putting file /var/spool/cups/tmp/45f97eeb64ea2 as \W32X86/HP4050.PPD (12812.8 kb/s) (average 12813.1 kb/s) putting file /usr/share/cups/drivers/ADOBEPS5.DLL as \W32X86/ADOBEPS5.DLL (15409.4 kb/s) (average 15027.7 kb/s) putting file /usr/share/cups/drivers/ADOBEPSU.DLL as \W32X86/ADOBEPSU.DLL (14722.1 kb/s) (average 14963.7 kb/s) putting file /usr/share/cups/drivers/ADOBEPSU.HLP as \W32X86/ADOBEPSU.HLP (9008.8 kb/s) (average 14699.1 kb/s) Running command: rpcclient localhost -N -U'root%novell' -c 'adddriver "Windows NT x86" "HP4050:ADOBEPS5.DLL:HP4050.PPD:ADOBEPSU.DLL:ADOBEPSU.HLP:NULL:RAW:NULL"' Printer Driver HP4050 successfully installed. Running command: smbclient //localhost/print\$ -N -U'root%novell' -c 'mkdir WIN40;put /var/spool/cups/tmp/45f97eeb64ea2 WIN40/HP4050.PPD;put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM;put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV;put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP;put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD;put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL;put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;' Domain=[GW7LX] OS=[Unix] Server=[Samba 3.0.20b-3.15-1162-SUSE] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40 putting file /var/spool/cups/tmp/45f97eeb64ea2 as \WIN40/HP4050.PPD (12812.8 kb/s) (average 12813.1 kb/s) putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM (15191.4 kb/s) (average 14908.3 kb/s) putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV (15065.1 kb/s) (average 15012.8 kb/s) putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP (14758.0 kb/s) (average 14989.0 kb/s) putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD (13174.5 kb/s) (average 14976.1 kb/s) putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL (14419.7 kb/s) (average 14946.0 kb/s) putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL (13999.7 kb/s) (average 14921.1 kb/s) Running command: rpcclient localhost -N -U'root%novell' -c 'adddriver "Windows 4.0" "HP4050:ADOBEPS4.DRV:HP4050.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,HP4050.PPD, ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"' Printer Driver HP4050 successfully installed. Running command: rpcclient localhost -N -U'root%novell' -c 'setdriver HP4050 HP4050' Succesfully set HP4050 to driver HP4050.
NOTE #1: during the process, the script will request the samba root password.
NOTE #2: the parameter -v is used to get a verbose output
NOTE #3: you can use the parameter -a to configure all printers and driver: cupsaddsmb -v -a
- Ready! Now your Windows workstations are able to download the printer driver directly from the server. From the workstation, browse to the CUPS/Samba server, open the Printers share, right-click on this printer and select "Install" or just double-click its. So, you should have a new printer in your workstation local "Printer" folder (in my LAB, "HP4050 on sles10srv").
Appendix # A
There is other way to configure automatically drivers download, you can upload the driver from the workstation to the [print$] samba share. But, in this case you need to use the "RAW" driver in the printer installation on CUPS service.
- Log into the workstation as the domain root (this is the Administrator account for the operating system that is the host platform for this implementation of Samba.
- Launch MS Windows Explorer. Navigate in the left panel. Click My Network Places->Entire Network->Microsoft Windows Network->"Your domain"->"Your server". Click on Massive Printers and Faxes.
- Identify a printer that is shown in the right panel. Let's assume the printer is called HP4050. Right-click on the HP4050 icon and select the Properties entry. This opens a dialog box that indicates that "The printer driver is not installed on this computer. Some printer properties will not be accessible unless you install the printer driver. Do you want to install the driver now?" It is important at this point to answer No.
- The printer properties panel for the HP4050 printer on your server is displayed. Click the Advanced tab. Note that the box labeled Driver is empty. Click the New Driver button that is next to the Driver box. This launches the "Add Printer Wizard".
- The "Add Printer Driver Wizard on <your server>" panel is now showed. Click Next to continue. From the left panel, select the printer manufacturer. In the right panel, select the printer. Click Next, and then Finish to start the driver upload.
- The driver upload can take few minutes. When it completes, you are returned to the Advanced tab in the Properties panel.
- Click OK. It will take a minute or so to upload the settings to the server. You will return to the Printers and Faxes screen. Right-click on the printer, click Properties->Device Settings. Now change the settings to suit your requirements. You need to change one setting and apply the changes. This is necessary so that the printer settings are initialized in the Samba printers database. Click Apply to commit your settings. Revert any settings you changed just to initialize the Samba printers database entry for this printer. If you need to revert a setting, click Apply again.
- Ready! Now, your workstations are able to download this printer driver automatically. You must repeat this process for all network printers (for every printer on each server).
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com