#脚本开始
#!/bin/bash
cd /etc/yum.repos.d/
tar -zcvf yum.bak.tar.gz CentOS-*
rm -rf CentOS*
touch /etc/yum.repos.d/a.repo
cat>/etc/yum.repos.d/a.repo <<EOF
[base]
name=base
baseurl=http://172.16.103.3/centos/7/os/x86_64
gpgcheck=1
enabled=1
gpgkey=http://172.16.103.3/centos/RPM-GPG-KEY-CentOS-7
[update]
name=update
baseurl=http://172.16.103.3/centos/7/updates/x86_64/
gpgcheck=1
enabled=1
gpgkey=http://172.16.103.3/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=extras
baseurl=http://172.16.103.3/centos/7/extras/x86_64
gpgcheck=1
enabled=1
gpgkey=http://172.16.103.3/centos/RPM-GPG-KEY-CentOS-7
[centosplus]
name=centosplus
baseurl=http://172.16.103.3/centos/7/centosplus/x86_64
gpgcheck=1
enabled=1
gpgkey=http://172.16.103.3/centos/RPM-GPG-KEY-CentOS-7
[epel]
name=epel
baseurl=http://172.16.103.3/epel/7/x86_64
gpgcheck=0
enabled=1
gpgkey=http://172.16.103.3/epel/RPM-GPG-KEY-EPEL-7
[epel-source]
name=epel-source
baseurl=http://172.16.103.3/epel/7/SRPMS
gpgcheck=0
enabled=1
gpgkey=http://172.16.103.3/epel/RPM-GPG-KEY-EPEL-7
EOF
yum clean all
yum makecache
#脚本结束