yum install nginx

13 年 ago jony yum install nginx已关闭评论

Create the file named/etc/yum.repos.d/nginx.repo with the following contents:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
OSRELEASE代表系统代号,5/6
OS代表你的系统名字,如果是centos 6就写成:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1

如果是红帽的,就把OS换成rhl

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5” or “6”, for 5.x or 6.x versions, respectively

保存退出,就可以

yum install nginx     yum会自动去判断安装最新稳定版的nginx