How To Create A Software Install List

Reading Time: 3 minutes

Purpose

The purpose of this article is to describe and explore ways to copy or backup your currently existing installed software titles into a single file for later use. We can then use this file to reinstall the software onto another system or clone the existing software across multiple Linux systems on or across a network. This method also prevents the need to install software titles one by one.

We have used a file named “allthethings.txt” to store a list of all of the currently installed software on our systems. 

Keep this list safe! If you format your system with the file still on it, you will lose all of the information needed to reinstall the software.

Note:
Using this method with the various package managers noted will only install the packages from the default official repositories or PPA’s. If you have enabled and installed other software from repositories other than the official default locations or PPA’s, they will not be included in the installs. If you need to install those additional software titles, you will need to add the repositories where the software is located before running the install in this manner.

To summarize, the following commands will accomplish the following on CentOS 7 & Ubuntu 18:

  • List all software.
  • List the number of packages installed.
  • Search for a specific package.
  • Add installed software to a text file.
  • Install software from a text file.

CentOS7

RPM

List all software:

[root@host ~]# rpm -qa

List number of packages installed:

[root@host ~]# rpm -qa | wc -l

Search for a specific package:

[root@host ~]# rpm -q tmux

Add installed software to a text file:

[root@host ~]# rpm -qa | tr '\n' ' ' > allthethings.txt

Install software from a text file:

There exists no method to restore from a file list using RPM. Yum must be used. 

YUM

List all software:

[root@host ~]# yum list installed

List number of packages installed:

[root@host ~]# yum list installed | wc -l

Search for a specific package:

[root@host ~]# yum list installed | grep unzip

Add installed software to a text file:

[root@host ~]# yum list installed | awk '{print $1}' | tr '\n' ' ' > allthethings.txt

Install software from a text file:

[root@host ~]# yum -y install $(cat allthethings.txt)

Ubuntu18

APT

List all software:

[root@host ~]# apt list --installed

List number of packages installed:

[root@host ~]# apt list --installed |  wc -l

Search for specific package:

[root@host ~]# apt list --installed | grep PHP

Add installed software to a text file:

[root@host ~]# apt list --installed > allthethings.txt
Or
[root@host ~]# apt list --installed | awk -F/ -v ORS=" " 'NR>1 {print $1}' > allthethings.txt

Install software from a text file:

[root@host ~]# xargs -a allthethings.txt apt install

DPKG

List all software:

[root@host ~]# dpkg -l | grep ^ii 

List number of packages installed:

[root@host ~]# dpkg -l | grep ^ii | wc -l

Search for specific package:

[root@host ~]# dpkg -l | grep ^ii | grep -i PHP

Add installed software to a text file:

[root@host ~]# dpkg-query -f '${binary:Package}\n' -W > allthethings.txt
or
[root@host ~]# dpkg --get-selections > allthethings.txt

Install software from a text file:

[root@host ~]# apt-get install < allthethings.txt

Further Detail

After reinstalling your base Linux system, copy or upload a copy of the ‘allthethings.txt’ file to your system. Please ensure you have installed the same version of your OS on your new or remote system. Once the file has been copied, install the packages from the allthethings.txt file using one of the above noted commands as the root user. The package manager will install all of the packages listed in the ‘allthethings.txt’ file on your system.

Talk To An Expert Today!

And there you have it! You can now feel safe when reinstalling all of your existing software on your systems into a new system!

If you are experiencing problems addressing this issue, give us a call today at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable System admins!

Author Bio

About the Author: David Singer

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Get 33% off the first 3 months on a new VPS! Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7x365 Support