知识

【Linux】centos7更换yum源

0x01 备份

先备份一下源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
转到源目录:
cd /etc/yum.repos.d/

0x02 下载

按照自己的版本下载源,以centos7为例,使用命令:
网易163源:
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
阿里云源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo //-O指定目录

0x03 安装

运行以下命令生成缓存:
yum clean all
yum makecache

0x04 指定安装目录

yum -c /etc/yum.conf --installroot=/opt/all_venv/ --releasever=/ install nginx
该命令简单解释如下:
-c /etc/yum.conf                  表示指定yum配置文件地址
--installroot=/usr/local        表示指定自定义的安装目录
 yum -c /etc/yum.conf --installroot=/usr/local/php72

三色堇
我还没有学会写个人说明!
查看“三色堇”的所有文章 →

相关推荐