How to: Migrate Linux Printer Configuration to Another System

I’ve already outlined the detailed steps for migrating users, home directories and email to a new Linux server. I received a couple of emails asking about migrating printer configuration. From my mail bag:

ADVERTISEMENTS

Is it possible to migrate the printer configuration from one machine to another, just like user migration?

Yes, it is possible since Linux uses CUPS i.e. the common unix printing system. It is a modular printing system for Unix-like computer operating systems that allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.

Migrate Linux Printer Configuration

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/cupsys restart

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
14 comments… add one
  • kolber911 Feb 20, 2008 @ 16:22

    thanks I was looking for this .

  • Alex C. Nov 16, 2008 @ 15:43

    Thanks – this helped me with my migration

  • someone Mar 27, 2009 @ 10:58

    the fact that this page was the first on my google search (something like “migrate linux printers terminal”) made the whole process be a matter of less than three minutes.
    THNX

  • Dirk Mar 18, 2010 @ 16:57

    Thanks for the info, but there is small typo on the remote server. Instead of tar -zcvf /tmp/cups*, it should say “tar -zxvf /tmp/cups*” — “x” for expand the cups* file.

  • The Rock Nov 26, 2010 @ 15:10

    Is it working when upgrading from Linux 3 to Linux 5.5 when cups is also a different version?

  • Gopal Nov 26, 2011 @ 13:37

    i want to install a laser printer in rhel linux pc guidelines

  • Glenn Jan 27, 2012 @ 16:06

    I’m sure we’re all great sysadmins, but in the steps above, to unpack the tar file you copied over you use:

    # tar -zcvf /tmp/cups*

  • Glenn Jan 27, 2012 @ 16:08

    OOPS!! Use:

    # tar -zxvf /tmp/cups*

    No ‘c’, which is for creating an archive, not unpacking it.

  • scott belbin Jan 31, 2013 @ 14:06

    The above commands worked great but I still can not see my printers under the Text Mode Setup Utility & printer configuration menu in red hat enterprise 4. The cups service was restarted

  • Fidtz Feb 27, 2013 @ 12:12

    Thanks for this post, it was really helpful, a massive time saver.

    Finding someone knowledgeable who says, yes it is actually still ok to copy config files in Linux is very re-assuring.

  • Nick Sep 4, 2013 @ 1:36

    How about the custom PPD’s in /usr/share/cups?

  • milen Sep 6, 2013 @ 16:54

    Hello,

    On the new Linux box – cups will fail to restart if in the config file:
    /etc/cups/cupsd.conf
    you have a line like this:
    Listen 192.168.1.10:631
    where 192.168.1.10 is the IP of the the Old Linux box.
    Replacing the IP of the old Linux box with IP of the new one, solves the problem!

    • Trevor Oct 6, 2013 @ 3:18

      You could also set the IP address to 127.0.0.1 – in which case it will work no matter what machine it is on

  • Shukor Mar 14, 2014 @ 6:41

    Guys,

    On my RHEL6.3, I was getting “Filter “/usr/lib64/cups/filter/foomatic-rip” error after restart the cups daemon. Issue solved once installed the foomatic rpm.

    foomatic-db-ppds-4.0-7.20091126.el6.noarch
    foomatic-db-filesystem-4.0-7.20091126.el6.noarch
    foomatic-db-4.0-7.20091126.el6.noarch
    foomatic-4.0.4-1.el6_1.1.x86_64

    Thanks nixCraft!! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.