Knowledgebase

How To Create A Software Install List

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.

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.

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 ‘.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 .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 ‘.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!

  • Apt, rpm, Yum, Software, Recover, CentOS, Installation, Ubuntu
  • 54 Users Found This Useful
Was this answer helpful?