本地yum源配
#!/bin/bash
cd /etc/yum.repos.d/;
mkdir repo_bak;
mv *.repo repo_bak;
echo "
[local]
name=local
baseurl=file:///mnt
enabled=1
gpgcheck=0
" > local.repo;
mount /dev/cdrom /mnt;
yum clean all && yum makecache;
在线阿里源
#!/bin/bash
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum -y install epel-release
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum list