[Linux]Centos 7系列配置本地及网络yum源
centos 配置本地yum源
[root@localhost~]mount /dev/cdrom /mnt #挂载光盘到mnt下
[root@localhost~]rm -rf /etc/yum.repos.d/*
[root@localhost~]vim /etc/yum.repos.d/centos.repo
按a插入编辑
[centos-yum] #yum源名称,随便取,用来区分不同的yum源
name=centos-source #yum源描述信息
baseurl=file:///mnt #yum源的路径(repodata目录所在的目录,一般光盘挂载到在哪就是哪里。
enable=1 #值为1,表示启用yum源
gpgcheck=0 #值为1检查要写,0不检查可不写
wq保存退出
yum使用:
[root@localhost~]yum clean all #清空yum缓存
[root@localhost~]yum list #重建yum列表
centos 配置网络yum源
[root@localhost~]mount /dev/cdrom /mnt #挂载光盘到mnt下
[root@localhost~]wget -O /etc/yum.repo.d/Centos-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #也可以使用网易http://mirrors.163.com的镜像开源站
[root@localhost~]sed -i ‘s/$releasever/7/g’ /etc/yum.repo.d/Centos-Base.repo
[root@localhost~]yum clean all
[root@localhost~]yum list
此方法也同样适用于rhel
源方法及更多内容访问:Linux