版权声明:作者-傲娇天子 博文主页地址:https://blog.csdn.net/qq_41116956 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢 https://blog.csdn.net/qq_41116956/article/details/82864481
备份linux本地源到新文件中:
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# mkdir Centos
[root@localhost yum.repos.d]# ls
163.repo.bak CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo
Centos CentOS-CR.repo CentOS-Media.repo
Centos-7.repo CentOS-Debuginfo.repo CentOS-Sources.repo
[root@localhost yum.repos.d]# mv * Centos
mv: 无法将目录"Centos" 移动至自身的子目录"Centos/Centos" 下
[root@localhost yum.repos.d]# ls
Centos
下载Centos-7的源,到该文件下(使用163的repo):
附带:
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2018-09-27 11:17:41-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 59.111.0.251
正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”
100%[=================================================>] 1,572 --.-K/s 用时 0s
2018-09-27 11:17:41 (122 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])
[root@localhost yum.repos.d]# ls
Centos CentOS7-Base-163.repo
更新缓存:
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum list
......
yum-rhn-plugin.noarch 2.0.1-10.el7 base
yum-updateonboot.noarch 1.1.31-46.el7_5 updates
yum-utils.noarch 1.1.31-46.el7_5 updates
zenity.x86_64 3.22.0-1.el7 base
zip.x86_64 3.0-11.el7 base
zlib.i686 1.2.7-17.el7 base
zlib.x86_64 1.2.7-17.el7 base
zlib-devel.i686 1.2.7-17.el7 base
zlib-devel.x86_64 1.2.7-17.el7 base
zlib-static.i686 1.2.7-17.el7 base
zlib-static.x86_64 1.2.7-17.el7 base
zsh.x86_64 5.0.2-28.el7 base
zsh-html.x86_64 5.0.2-28.el7 base
zziplib.i686 0.13.62-5.el7 base
zziplib.x86_64 0.13.62-5.el7 base
zziplib-devel.i686 0.13.62-5.el7 base
zziplib-devel.x86_64 0.13.62-5.el7 base
zziplib-utils.x86_64 0.13.62-5.el7 base
安装epel源:
[root@localhost yum.repos.d]# yum install -y epel-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成
依赖关系解决
===========================================================================================
Package 架构 版本 源 大小
===========================================================================================
正在安装:
epel-release noarch 7-11 extras 15 k
事务概要
===========================================================================================
安装 1 软件包
总下载量:15 k
安装大小:24 k
Downloading packages:
epel-release-7-11.noarch.rpm | 15 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : epel-release-7-11.noarch 1/1
验证中 : epel-release-7-11.noarch 1/1
已安装:
epel-release.noarch 0:7-11
完毕!
[root@localhost yum.repos.d]# ls
Centos CentOS7-Base-163.repo epel.repo epel-testing.repo
完成!