1.進入以下目錄
cd /etc/yum.repos.d
2.清空目錄內容
rm -rf *
3.創(chuàng)建文件目錄,掛載iso鏡像
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
4.創(chuàng)建repo文件,并填充以下內容
[test-server]
name=test
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
5.此時本地yum源已經可以使用,但是地址是國外,如果要配置阿里云yum源,可以先下載wget工具
yum -y install wget
6.對本地yum源進行刪除或者備份
備份命令如下:注意yum源的名字可能不同
mv /etc/yum.repos.d/test.repo /etc/yum.repos.d/test.repo.backup
7.下載阿里云的yum源
阿里巴巴開源鏡像站:阿里巴巴開源鏡像站-OPSX鏡像站-阿里云開發(fā)者社區(qū)文章來源:http://www.zghlxwxcb.cn/news/detail-622645.html
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
8.清除和創(chuàng)建緩存文章來源地址http://www.zghlxwxcb.cn/news/detail-622645.html
yum clean all
yum makecache
到了這里,關于配置本地yum源,并更換阿里源的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!