Skip to main content

Install All Packages After Restore on RPM-based Linux

·301 words·2 mins

In the last days I had a problem with a crashed virtual disk on a WebSphere Application Server. The backup team was able to recover all the data, but the operating system needs to be reinstalled. The operating system was Red Hat Linux, so rpm-based. One of the first tasks after recovery was to identify and reinstall missing packages.

A big advantage was that several WebSphere nodes were used in this environment, the Deployment Manager was still intact, and a still working server could be used as a basis for determining the missing packages.

I used the following commands:

On a working node

rpm -qa | sort > all-packages-node1.txt

On the restored machine

rpm -qa | sort > all-packages-restored.txt

Now we need to compare the lists and generate a list of all missing packages:

comm -23 all-packages-node1.txt all-packages-restored.txt > missing-packages.txt

So we have a list of missing packages, in this case I had to install about 200 packages. I’m a little lazy and didn’t want to enter or copy and paste all the package names. So let’s use a short bash snippet (not very elegant, but it works):

while read $i; do
    sudo yum -y install $i
done < missing-packages.txt

The installation process takes a few minutes, but after that all missing packages should be reinstalled. If additional repositories are needed, they should be reactivated or added before the installation process. Manually installed RPM packages can be found by repeating the above procedure and checking for missing packages.

I also used these snippets when I changed my working machine. So I created a backup list of all installed applications and reinstalled everything on the new computer.

Points learned

I now regularly create the list of installed packages so that it can be stored on the backup tapes and used during recovery.

Christoph Stoettner
Author
Christoph Stoettner
I work at Vegard IT GmbH as a senior consultant, focusing on collaboration software, Kubernetes, security, and automation. I primarily work with HCL Connections, WebSphere Application Server, Kubernetes, Ansible, Terraform, and Linux. My daily work occasionally leads to technical talks and blog articles, which I share here more or less regularly.

Related

Asciidoctor Windows

During my talk at FrOSCon I wasn’t sure how to install Asciidoctor on Windows. So I tried on a Windows 10 VM. When you want to use Asciidoctor on a Windows desktop, you need to download the Rubyinstaller and install it. Now you can open a administrative command window and install with gem install asciidoctor.

Kubernetes 101 - Docker Mannheim

·98 words·1 min
Today I had the pleisure to give a talk about Kubernetes Basics at the Docker Mannheim Meetup. I enjoyed it very much and we had some very good discussions after the talk with the traditional pizza and drinks sponsored by Stocard. A big shout-out to Jens and Martina for organizing the meetup!