对于追求速度的Linux服务器安装,rpm确实是一个不错的选择,但是很多服务在基本yum源内没有rpm包,如openvpn,htop等。此时扩展yum源确实是一个不错选择,下面脚本实现CentOS 5.0以上版本64位和32位的扩展yum源。
#!/bin/bash
function RPMforge6 {
if [ $1 == x86_64 ];then
rpm --import
rpm -K
rpm -i
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong on rpm RPMforge \033[0m"
else
rpm --import
rpm -K
rpm -i
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong on rpm RPMforge \033[0m"
fi
}
function RPMforge5 {
if [ $1 == x86_64 ];then
wget
rpm --import
rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong on rpm RPMforge \033[0m"
rm -rf rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
else
wget
rpm --import
rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong on rpm RPMforge \033[0m"
rm -rf rpmforge-release-0.5.2-2.el5.rf.i386.rpm
fi
}
cd /etc/yum.repos.d/
for i in `ls /etc/yum.repos.d/`; do
if [ "${i##*.}" = "bak" ];then
echo "$i is backup"
else
mv $i $i.bak
fi
done
version=`cat /etc/issue | awk '{if(NR==1) print $3}'i`
gaby=`expr $version \> 6.0`
if [ $gaby -eq 1 ];then
wget
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong,please check your networking \033[0m"
RPMforge6 `uname -i`
else
gaby=`expr $version \> 5.0`
if [ $gaby -eq 1 ];then
wget
[ $? -eq 0 ] || echo -e "\033[31m there are something wrong,please check your networking \033[0m"
RPMforge5 `uname -i`
else
echo "the centos Low version"
fi
fi
成功后不要忘记yum -y update