banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

One Way To Duplicate Your Installation On Another Computer


by Paul Arnote (parnote)

Linux users, as a group, tend to reuse computers that most others toss aside or discard. Often times, we purchase computers that aren't necessarily considered "cutting edge." Typically, there is a lot of life left in these computers that others relegate to the scrap heap. Even for myself, I haven't purchased a "new" computer in many years ... not counting the desktop computer I built several years from scratch. Certainly, nearly every laptop I've ever owned (except one) were either refurbs, purchased used, or were one of those "discards" that were given to me. Even my current "production" laptop (the one I use daily) is a one or two year old laptop purchased used off of Ebay.

So, from time to time, we Linux users find or receive an "upgrade" computer. Now, you have your present computer and OS installation tuned like a high performance racing machine. You have all of your favorite programs installed. Now, you want to install PCLinuxOS on your newer, upgraded computer. One of the last things you want to do is to forget to install all your favorite programs.

When you install PCLinuxOS on your newer computer, you will undoubtedly want to install from a more recent ISO or LiveCD/DVD/USB. All of your favorite programs probably aren't included on the base PCLinuxOS live media. Sure, you could remaster your current installation, but then you drag all of the old baggage from your current installation along with you, and deposit it on your new computer. And, undoubtedly and in any case, you will definitely have some "tuning" to do on your new computer.

So, along these lines, bushrang3r, a.k.a. timeth, made the following post in the PCLinuxOS forum on June 12, 2018:

Hello good people,

I'm just wondering about something and I thought I'd run this idea past everyone. Maybe it's impossible, maybe folks wouldn't find it useful, maybe they would. I'd just like to get some input into the validity / possibility of the idea.

Everyone probably knows that when you reinstall your OS, you need to install all the apps you had installed on your old install. I usually run $ rpm -qa to get a complete list of installed apps before the reinstall so I can go through it and install the same ones on the new install. However, this list is exhaustive. It includes libraries, kernels, docs, dependencies etc. and it takes quite a while to go through it and find the ones I want. I did some research and found out how to write a list of apps in /usr/share/applications to a text file but it still isn't ideal.

What if there was a way to filter apps I installed (the main executables) in synaptic to show only those e.g. Firefox, excluding its dependencies, libraries etc. and then write that list to a file, reload that file into synaptic on the new install and reinstall all the apps (and by association their dependencies too) in one hit?

Would it require some kind of tagging of rpm names in the repos so that they could be filtered? Would that be an impossible task?

Do people think it would be useful?

Two replies later, Old-Polack had what might be the best solution to the issue.

I have three scripts that, used in the order given, do just what you ask for. The first is used on the original installation that you wish to duplicate.

-------------------------- start -------------------------
#!/bin/sh
# Name: genlist
# Author: Polack
# Script to generate an existing system's installed package list
# to aid in re-installation, and upgrade.
#

rpm -qa --qf '%{NAME}\t\tinstall\n' | sort |grep -v kernel |grep -v lib > ~/installed-packages.txt

exit

---------------------------- end ---------------------------

Running this results in a text file named installed-packages.txt in your $HOME directory. Copy this to a USB flash drive for later use in the new installation. Note that it is in a form that can be used directly by Synaptic, but does not include any library or kernel packages. The next script is basically the same script, but with a different output text file, to be used on the new installation, to list the initial base installation packages.

---------------------------- start ---------------------------
#!/bin/sh
# Name: newlist
# Author: Polack
# Purpose: Script to generate a base installed package list, from a new installation,
# to aid in re-installation, and upgrade.
#

rpm -qa --qf '%{NAME}\t\tinstall\n' | sort |grep -v kernel |grep -v lib > ~/new-installed.txt

exit

---------------------------- end -----------------------------

Copy the text file from the USB flash drive into the new installation's $HOME directory so that both the installed-packages.txt and the new-installed.txt files are visible, side by side.

The last script is named difflist and generates another new file named to-install.txt, which can be used directly by Synaptic to add all the user installed packages from the original installation, without having to reinstall all the base installation included packages.

---------------------------- start ----------------------------
#!/bin/sh
# Name: difflist
# Author: Polack
# Purpose: Script to generate a package list containing
# only packages added to a default installation,
# to aid in re-installation, and upgrade.
#

diff -dHrN -- installed-packages.txt new-installed.txt |grep \< |sed "s/< //" > to-install.txt

exit

----------------------------- end -----------------------------

In Synaptic, after running the initial upgrade procedure, under File --> Read Markings... navigate to, and select, /home/<your username>/to-install.txt, then click Apply.

Copy the text of each of the scripts into the text editor of your choice, save each, with the appropriate name, into a /home/<your username>/bin directory (which you need to create, and will automatically be in your $PATH) and make each executable. When you copy the installed-packages.txt file to the USB flash drive, also copy your /home/<your username>/bin directory to the flash drive as well, to transfer both to the new installation.

Now, by following Old-Polack's directions precisely, and executing his custom bash scripts, you can have all of your favorite programs installed in one fell swoop. I don't know about you, but whenever I've had to reinstall PCLinuxOS on a newer computer, I've always forgotten programs to install. As a result, I've always had to go back into Synaptic multiple times before finally reinstalling all my favorite programs. Had I thought of or knew about this method, it would have saved me so much time.



Previous Page              Top              Next Page