先备份一下源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
转到源目录:
cd /etc/yum.repos.d/
按照自己的版本下载源,以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指定目录
运行以下命令生成缓存:
yum clean all
yum makecache
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