centos5.6配置本地源

现在网上已经没有centos6.5能用的源了,所以自己建是最方便,稳妥的了,写了一个脚本自动搞定

#!/bin/bash
dir=$(pwd)
if [ ! -f "$dir/CentOS-6.5-x86_64-bin-DVD1.iso" ];then
  curl -o CentOS-6.5-x86_64-bin-DVD1.iso http://192.168.0.6/CentOS-6.5-x86_64-bin-DVD1.iso
fi

mkdir /mnt/yum
mount -o loop $dir/CentOS-6.5-x86_64-bin-DVD1.iso /mnt/yum
rm -f /etc/yum.repos.d/*
cat>/etc/yum.repos.d/local.repo<<EOF
[local_server]
name=my local yum src
baseurl=file:///mnt/yum
enabled=1
gpgcheck=0
EOF

yum clean all
yum makecache
yum install -y lrzsz

 

posted on 2023-04-26 09:23  弘道者  阅读(17)  评论(0编辑  收藏  举报