Programmatically installing a list of Linux Packages read from a file

The only thing that you would have to change in the following is the name of the file (file0) and then the command to load the RPMs … they use up2date here but you could change out to “rpm -Uvh $line”. 

My text file is just a list of packages (each package on a separate line). 

#!/bin/bash
#Check to make sure that the file containing the list of packages is present
file0=”/home/oracle/rh_packages.txt”
if [ -f “$file0” ]; then
  while read line
  do up2date $line
  done < “$file0”
else
  echo -n “List of packages is not available, skipping package install”
fi

Leave a Comment

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

Scroll to Top