#!/bin/bash
### Apt Control ###
#
# Written by Mel to reduce the suffering of a Centos5 install for a friend.
#
# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
rh_file="/etc/redhat-release"
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
fi;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv http://apt.sw.be/redhat/$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd http://mirror.centos.org centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
Friday, March 12, 2010
Apt on Centos!
I have recently had a chat with a vendor whom as a newbie to linux, but had a fairly great grasp on Ubuntu. He was set to acquire a few centos boxes and needed assistance with keeping them up too date. I tried teaching him Yum but it really didnt work so well so :) I came up with a cool script:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment