centos7直接yum安装nginx

导入源

导入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 repo
baseurl=http://nginx.org/packages/mainline/rhel/7/$basearch/
gpgcheck=0
enabled=1

导入key

rpm –import http://nginx.org/keys/nginx_signing.key

 

查看yum中的nginx信息

[root@localhost ~]# yum info nginx
Loaded plugins: fastestmirror, langpacks
nginx                                                                                                                                                                                                                 | 2.9 kB  00:00:00
nginx/x86_64/primary_db                                                                                                                                                                                               |  19 kB  00:00:00
Loading mirror speeds from cached hostfile
 * base: centos.nethub.com.hk
 * extras: centos.nethub.com.hk
 * updates: centos.nethub.com.hk
Available Packages
Name        : nginx
Arch        : x86_64
Version     : 1.10.2
Release     : 1.el6.ngx
Size        : 825 k
Repo        : nginx/x86_64
Summary     : High performance web server
URL         : http://nginx.org/
Licence     : 2-clause BSD-like license
Description : 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

 

 

 

 

 

 

 

转载于:https://my.oschina.net/yehun/blog/893222

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值