1、YUM 更换国内源
1)进入仓库目录
- [[email protected]~]# cd /etc/yum.repos.d
- [[email protected]yum.repos.d]# ls
- dvd.repo
2)删除仓库源
- [[email protected]yum.repos.d]# rm -f dvd.repo
3)下载仓库源
- [[email protected]yum.repos.d]# curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 100 1572 100 1572 0 0 7343 0 --:--:-- --:--:-- --:--:-- 7380
- [[email protected]yum.repos.d]# ls
- CentOS7-Base-163.repo
也可以使用 wget 下载。
4)查看软件列表
- [[email protected]yum.repos.d]# yum list
- ......
- net-tools.x86_64 2.0-0.17.20131004git.el7 @base
- perl.x86_64 4:5.16.3-291.el7 @base
- perl-Carp.noarch 1.26-244.el7 @base
- perl-Encode.x86_64 2.51-7.el7 @base
- perl-Exporter.noarch 5.68-3.el7 @base
- perl-File-Path.noarch 2.09-2.el7 @base
- perl-File-Temp.noarch 0.23.01-3.el7 @base
- perl-Filter.x86_64 1.49-3.el7 @base
- perl-Getopt-Long.noarch 2.40-2.el7 @base
- perl-HTTP-Tiny.noarch 0.033-3.el7 @base
- perl-PathTools.x86_64 3.40-5.el7 @base
- perl-Pod-Escapes.noarch 1:1.04-291.el7 @base
- perl-Pod-Perldoc.noarch 3.20-4.el7 @base
- ......
2、安装扩展源 epel
1)安装 epel
- [[email protected]~]# yum install -y epel-release
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 epel-release.noarch.0.7-9 将被 安装
- --> 解决依赖关系完成
- 依赖关系解决
- ================================================================================
- Package 架构 版本 源 大小
- ================================================================================
- 正在安装:
- epel-release noarch 7-9 extras 14 k
- 事务概要
- ================================================================================
- 安装 1 软件包
- 总下载量:14 k
- 安装大小:24 k
- Downloading packages:
- epel-release-7-9.noarch.rpm | 14 kB 00:00
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- 正在安装 : epel-release-7-9.noarch 1/1
- 验证中 : epel-release-7-9.noarch 1/1
- 已安装:
- epel-release.noarch 0:7-9
- 完毕!
2)查看 epel 可安装的包
- [[email protected]~]# yum list | grep epel
- * epel: mirrors.tuna.tsinghua.edu.cn
- epel-release.noarch 7-9 @extras
- 0ad.x86_64 0.0.21-1.el7 epel
- 0ad-data.noarch 0.0.21-1.el7 epel
- 0install.x86_64 2.11-1.el7 epel
- 2048-cli.x86_64 0.9.1-1.el7 epel
- 2048-cli-nocurses.x86_64 0.9.1-1.el7 epel
- 2ping.noarch 3.2.1-2.el7 epel
- 389-admin.x86_64 1.1.46-1.el7 epel
- 389-admin-console.noarch 1.1.12-1.el7 epel
- 389-admin-console-doc.noarch 1.1.12-1.el7 epel
- 389-adminutil.x86_64 1.1.21-2.el7 epel
- 389-adminutil-devel.x86_64 1.1.21-2.el7 epel
- 389-console.noarch 1.1.18-1.el7 epel
- 389-ds.noarch 1.2.2-6.el7 epel
- 389-ds-console.noarch 1.2.16-1.el7 epel
- 389-ds-console-doc.noarch 1.2.16-1.el7 epel
- 389-dsgw.x86_64 1.1.11-5.el7 epel
- 3proxy.x86_64 0.7-1.el7 epel
- 3proxy-sysvinit.x86_64 0.7-1.el7 epel
- Agda.x86_64 2.3.2.2-5.el7 epel
- ......
3、YUM 下载 rpm 包
- [[email protected]~]# yum install -y vim-enhanced --downloadonly
- ##"--downloadonly"指明只下载不安装
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: mirrors.tuna.tsinghua.edu.cn
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 vim-enhanced.x86_64.2.7.4.160-1.el7_3.1 将被 安装
- --> 解决依赖关系完成
- 依赖关系解决
- ================================================================================
- Package 架构 版本 源 大小
- ================================================================================
- 正在安装:
- vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
- 事务概要
- ================================================================================
- 安装 1 软件包
- 总下载量:1.0 M
- 安装大小:2.2 M
- Background downloading packages, then exiting:
- vim-enhanced-7.4.160-1.el7_3.1.x86_64.rpm | 1.0 MB 00:00
- [[email protected]~]# ls /var/cache/yum/x86_64/7/
- base dvd epel extras timedhosts timedhosts.txt updates
- [[email protected]~]# yum install -y vim-enhanced --downloadonly --downloaddir=/usr/local/
- ##"--downloaddir"指定路径
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- * epel: mirrors.ustc.edu.cn
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 vim-enhanced.x86_64.2.7.4.160-1.el7_3.1 将被 安装
- --> 解决依赖关系完成
- 依赖关系解决
- ========================================================================================================================================================================
- Package 架构 版本 源 大小
- ========================================================================================================================================================================
- 正在安装:
- vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
- 事务概要
- ========================================================================================================================================================================
- 安装 1 软件包
- 总计:1.0 M
- 安装大小:2.2 M
- Background downloading packages, then exiting:
- exiting because "Download Only" specified
如果一个安装包已经被安装,可以使用 yum reinstall 的方式去下载或重装。
来源: http://www.bubuko.com/infodetail-2141299.html