HowTo Duplicate Printers Between Linux Systems

So you are like me an APPS SysAdmin and a DBA, and one of the repetitive tasks that I am in charge is cloning instances of Oracle APPS / EBS across different Linux machines. Especially during early implimentation stages of Oracle apps. Various incarnation of the server is being cloned from POC, UAT, Dev and PROD.

One tedious tasks while cloning is making the printers between this Linux systems exactly the same. One of the client were currently working on has more or less 10 printers allocated to Oracle printing.

The operating systems being used here is Redhat 4 EL, using CUPS printing.
The printers are attached to XP workstations configured with LPR printing services. This is  our preferred setup because it does away with quirky Windows access control and permission issues. While I must admit that this is not very safe because for the same reason that it is so straightforward to configure and use, there is no access control! (anyone[the techie ones] can print on anybody’s printer, think consuming the entire box of continous paper loaded 🙂

I’ll make a separate post on how to connect Oracle Apps/Linux server to Windows client printer via LPD.( email me if you need it sooner than i can find time to post   j o e s y k i @ g m a i l  🙂

Now on to duplicating, migrating or simply making a backup of all printers installed on linux machine.

CUPS stores its configuration at /etc/cups directory, so all you have to do is copy /etc/cups to a new computer. Open terminal and type the commands on old Linux computer:
# tar -cvzf /tmp/cups-$(hostname).tar.gz /etc/cups
Copy /tmp/cups* to new system using SCP or use USB pen driver:
# scp /tmp/cups* new.linux.server.com:/tmp

Now login to new system and type the following commands:
# mv /etc/cups /etc/cups.backup
# cd /
# tar -zxvf /tmp/cups*

Finally, restart the cups service:
# /etc/init.d/cups restart

This trick will recreate the CUPS printers from one linux system to another. However one issue I noticed (on RHEL4) is that the printers will not show up when you use Syste-Print-config gui. You have to check using the CUPS web console @ http://localhost:631/printers or via console:

# lpstat -a

Im still researching on how to make it show up in PrintConfig gui.

— Update!!

The solution to make it magically appear in System-Print-Config gui is:

After doing the above procedures,
On the source system we have to export the settings using the commands

# system-config-printer-tui –Xexport > /tmp/settings.xml

Copy the /tmp/settings.xml to target, shutdown the CUPS server.

# system-config-printer-tui –Ximport < /tmp/settings.xml

# /etc/init.d/cups start

And viola!!


Advertisements

About this entry