【深入浅出Linux】yum配置阿里云镜像和本地仓库的过程

一.配置阿里云镜像

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum clean all清除缓存

4、运行yum makecache从阿里云中加载仓库的metadata数据,生成缓存。

5、查看仓库的信息列表 yum repolist ,配置成功

二.配置本地仓库ISO镜像文件

1.备份之前的仓库信息

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.挂在本地的仓库ISO镜像文件
mount /dev/cdrom /mnt/
3.修改CentOS-Base.repo文件

baseurl=file:///mnt
gpgcheck=0
enable=1

4、之后运行yum clean all清除缓存

5、运行yum makecache,生成缓存。

6、查看仓库的信息列表 yum repolist ,配置成功

你可能感兴趣的:(【深入浅出Linux】yum配置阿里云镜像和本地仓库的过程)