搭建本地yum源(CentOS_5.5)

#!/bin/env  bash
#OS CentOS_5.5
#install localyum
#write by fairyzoro

#set -x
mkdir /media/cdrom
umount /dev/cdrom
dd if=/dev/cdrom count=1 bs=1 of=/dev/null &>/dev/null
if [ "$?" != 0 ];then
echo "**************************"
echo "*******  ERROR !  ********"
echo "*** Cant't find CD-ROM ***"
echo "**************************"
exit 1
fi
mount /dev/cdrom /media/cdrom
if [ "$?" != 0 ];then
echo "**************************"
echo "*** Mount CD-ROM ERROR ***"
echo "**************************"
exit 1
fi

mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak/

cat > /etc/yum.repos.d/localyum.repo <<EOF
[base]
name=Server
baseurl=file:///media/cdrom
gpgcheck=0
enabled=1
EOF

yum clean all
yum list all

 

 

说明:本yum源针对CentOS_5.5    如果要用在RHEL_5.4上,修改如下:

cat > /etc/yum.repos.d/localyum.repo <<EOF
[base]
name=Server
baseurl=file:///media/cdrom/Server
gpgcheck=0
enabled=1
EOF

 

附下载:http://down.51cto.com/data/335416

你可能感兴趣的:(centos,yum,本地,源,休闲)