导入源 导入rpm包 rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.
导入源
导入rpm包
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
或者
创建源
安装准备依赖lib库
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
创建/etc/yum.repos.d/nginx.repo
添加以下,以centos7为例
[nginx]name=nginx repobaseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/gpgcheck=0enabled=1
导入key
rpm –import http://nginx.org/keys/nginx_signing.key
查看yum中的nginx信息
[root@localhost ~]# yum info nginxLoaded plugins: fastestmirror, langpacksnginx | 2.9 kB 00:00:00nginx/x86_64/primary_db | 19 kB 00:00:00Loading mirror speeds from cached hostfile * base: centos.nethub.com.hk * extras: centos.nethub.com.hk * updates: centos.nethub.com.hkAvailable PackagesName : nginxArch : x86_64Version : 1.10.2Release : 1.el6.ngxSize : 825 kRepo : nginx/x86_64Summary : High performance web serverURL : http://nginx.org/Licence : 2-clause BSD-like licenseDescription : nginx [engine x] is an HTTP and reverse proxy server, as well as : a mail proxy server.
安装
[root@localhost ~]# yum install nginx
启动
[root@localhost ~]# service nginx start