一、yum更换国内源
1、前往yum文件路径地址
[root@web1 ~]# cd /etc/yum.repos.d/ [root@web1 yum.repos.d]# ls CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo [root@web1 yum.repos.d]#
2、下载相应的原包地址
[root@web1 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo --2019-05-21 22:36:41-- http://mirrors.163.com/.help/CentOS7-Base-163.repo Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251 Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1572 (1.5K) [application/octet-stream] Saving to: ‘CentOS7-Base-163.repo.1’ 100%[===============================================================================================>] 1,572 --.-K/s in 0.001s 2019-05-21 22:36:41 (2.84 MB/s) - ‘CentOS7-Base-163.repo.1’ saved [1572/1572] [root@web1 yum.repos.d]#
3、列出所有可安装的包
[root@web1 yum.repos.d]# yum list
4、如果一个163和base的源不够用的情况下,可以安装一个扩展源epel
yum install -y epel-release
yum list |grep epel
二、yum下载rpm包
1、下载包不安装
[root@web1 yum.repos.d]# yum install -y 包名 --downloadonly --downloaddir=路径
2、已经安装的包要重新安装
[root@web1 yum.repos.d]# yum reinstall -y 包名 --downloadonly --downloaddir=路径
****将需要的rpm包打包好以后再使用时便可直接调用了****
参考:https://blog.csdn.net/mojianbin/article/details/78533260
参与评论
手机查看
返回顶部