Solved

Shell script to install rpms and verify

Posted on 2014-08-01
8
70 Views
Last Modified: 2016-07-17
Hi,

I am writing a shell script to install packages (rpms) that are required for oracle installation. I can install individually but want to write a script so that its easy.

First, I am creating a file called "pkgs" which contains the required packages (both 32 and 64 bit). BTW I am using Oracle Enterprise Linux 5.x 64 bit.

My script would call the packages from file "pkgs" and then removes a word called "(32 bit)" and send the out put to a different file. And then use yum install to install packages from a different file (using a for loop)

once completed then I want to verify if all the packages are installed correctly (both 32 vs 64) and this is where I ran to issues.  

Would someone please correct the script or suggest something?

Below is the script:

[root@localhost ~]# cat script1
#!/bin/bash

echo "Below are full pkg list"
echo
cat pkgs
echo
echo "We are now removing 32 bit tag from above pkgs"
echo
PKGNO32TAG=$(sed 's/(32 bit)/ /g' pkgs > pkgs.no32tag)
PKGONLY32=$(cat pkgs | grep -i "(32 bit)")
echo $PKGONLY32 > PKGONLY32LIST
PKGTRIM32TAG=$(sed -i 's/(32 bit)/ /g' PKGONLY32LIST  > pkg.trim32tag)
echo "removing 32 bit tag is complete and saved in pkg.trim32tag"

echo
echo "installing all pkgs using yum"
for a in `cat pkg.trim32tag`; do yum install -y $a; done
echo "done"

echo "checking if 32 bit pkgs are installed or not"
echo "list of total 32 bit pkgs"
echo
cat PKGONLY32LIST

echo "Now verifying"
for b in `cat PKGONLY32LIST`; do rpm -qa --qf "%{name}-%{version}-%{release}.%{arch}\n" $b; done

echo "done"


Below is the "pkgs" file contains the rpms:


[root@localhost ~]# cat pkgs
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
compat-libstdc++-33-3.2.3 (32 bit)
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-2.5-24 (32 bit)
glibc-common-2.5
glibc-devel-2.5
glibc-devel-2.5 (32 bit)
glibc-headers-2.5
ksh-20060214
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc++-4.1.2
libstdc++-4.1.2 (32 bit)
libstdc++-devel 4.1.2
make-3.81
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-2.2.11 (32 bit)
unixODBC-devel-2.2.11
unixODBC-devel-2.2.11 (32 bit)
openmotif


tanks
0
Comment
Question by:luser9999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 40233926
You can do same with YUM
Check this: http://yum.baseurl.org/wiki/YumGroups
0
 

Author Comment

by:luser9999
ID: 40234221
Yes, I do use YUM. I set up local YUM as well
0
 

Author Comment

by:luser9999
ID: 40234351
Any ideas or help regarding the script I wrote?

thansk
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 62

Accepted Solution

by:
gheist earned 500 total points
ID: 40234464
instead of (32bit) use .i?86
Then even on 32bit system it will go fine and accept default package

e.g
# yum install (-y) libstdc++-4.1.2 libstdc++-4.1.2.i?86
(i'd drop exact version to acomodate system patches e.g. libstdc++ libstdc++.i?86)

Yum exits cleanly (0) - it is installed fine, if other return code - something is missing.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40234964
No need to reinvent the wheel

just
"yum install oracle-validated"
And you can run oracle installer right away.
0
 
LVL 62

Expert Comment

by:gheist
ID: 41713478
https:#a40234964
(works on Oracle Linux only)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question