Nov.19

Redhat -6 Local and Online Repo creation script

Hi Friends.

 

I was testing some backup software’s, each day i used to create separate Virtual Machine on my Vmware. After installation of RHEL 6, configuring local and online repos are my first job (I am bit lazy to do this every time).

 

For that i created a shell script to do this things automatically.

 

I am not a scripting expert. Here is my script. I tested with Rhel6 only

 

 

#!/bin/bash#Created by Ben T George – ben@benvin.net
echo “Unmounting mounted DVD “;
umount /media/R*
echo “creating /rhel directory”;
mkdir /rhel
echo “Mounting DVD to /rhel”
mount /dev/sr0 /rhel;
echo “Creating Local Repo”
cat > /etc/yum.repos.d/cd.repo << EOF
[Packages] name=Red Hat Enterprise Linux Packages
baseurl=file:///rhel
enabled=1
gpgcheck=0[HighAvailability] name=Red Hat Enterprise Linux HighAvailability
baseurl=file:///rhel/HighAvailability
enabled=1
gpgcheck=0

[LoadBalancer] name=Red Hat Enterprise Linux LoadBalancer
baseurl=file:///rhel/LoadBalancer
enabled=1
gpgcheck=0

[ResilientStorage] name=Red Hat Enterprise Linux ResilientStorage
baseurl=file:///rhel/ResilientStorage
enabled=1
gpgcheck=0

[Server] name=Red Hat Enterprise Linux Server
baseurl=file:///rhel/Server
enabled=1
gpgcheck=0
EOF
echo ” Installing 3rd party online repos”
echo ” Installing EPEL ”
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
echo ” Installing RPM Fusion”
yum -y localinstall –nogpgcheck http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
echo ” Installing Rpmforge Latest repos”
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.`uname -m`.rpm
sleep 2
echo “Installation finished – Going to refresh repos”
yum clean all
yum repolist
sleep 5
pkill yum
yum list all

 

This script will configure all Repos including HA,LB.

Share this Story:
  • facebook
  • twitter
  • gplus

About bentech4u

Leave a comment