「Nginx」- 安装

更新日期:2019年08月10日

# 08/10/2019 CentOS Linux release 7.6.1810 (Core)

按照道理将应该不会有什么问题,但是在阿里云的CentOS系统里找不到这个包。

可以直接从官方的源中安装:

#!/bin/sh

# http://nginx.org/packages/centos/7/x86_64/RPMS/
rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.8.1-1.el7.ngx.x86_64.rpm

# 05/08/2019 RHEL/CentOS

#!/bin/sh

# 配置源
cat << 'EOF' > /etc/yum.repos.d/cstm-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

[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
EOF

# 启用mainline版本(此时需要安装yum-utils包)
# yum install -y yum-utils
# yum-config-manager --enable nginx-mainline

# 更新缓存
yum makecache

# 安装
yum install -y nginx.x86_64

参考文献


ToC

# 08/10/2019 CentOS Linux release 7.6.1810 (Core)

# 05/08/2019 RHEL/CentOS

参考文献