1、yum安装
1.1、基础软件安装
yum install -y wget vim net-tools epel-release
1.2、配置yum源
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
1.3、安装
安装命令:yum install nginx
错误一:Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again
修改方法:修改/etc/yum.repos.d/epel.repo
文件,取消baseurl注释,增加metalink注释,具体如下
错误二:GPG key retrieval failed: [Errno 14] curl#35 - "Peer reports incompatible or unsupported protocol version."
修改方法:yum update -y nss curl libcurl
1.4、验证
1.4.1、常用命令
启动命令:systemctl start nginx
重启命令:systemctl restart nginx
关闭命令:systemctl stop nginx
开机自启&#