源码包安装nginx

[root@pxe ~]# ls
anaconda-ks.cfg  nginx-1.10-3.src.rpm  nginx-1.10-3.x86_64.rpm  original-ks.cfg
[root@pxe ~]# rpm -ivh nginx-1.10-3.src.rpm 
正在升级/安装...
   1:nginx-1.10-3                     ################################# [100%]

[root@pxe ~]# cd rpmbuild/
[root@pxe rpmbuild]# ls
SOURCES  SPECS
[root@pxe rpmbuild]# ll
总用量 0
drwxr-xr-x 2 root root 92 9月   4 10:20 SOURCES
drwxr-xr-x 2 root root 24 9月   4 10:20 SPECS
[root@pxe rpmbuild]# cd SOURCES/
[root@pxe SOURCES]# ll
总用量 908
-rw-r--r-- 1 root root    604 2月  11 2018 conf.patch
-rw-r--r-- 1 root root   6016 2月  10 2018 myconf.patch
-rw-r--r-- 1 root root 911509 2月  10 2018 nginx-1.10.3.tar.gz
-rw-r--r-- 1 root root    504 2月  10 2018 nginx.service
[root@pxe SOURCES]# cd ..
[root@pxe rpmbuild]# cd SPECS/
[root@pxe SPECS]# ls
nginx.spec   //应答文件

[root@pxe SPECS]# rpmbuild  -bs nginx.spec    //报错是没有安装依赖包
写道:/root/rpmbuild/SRPMS/nginx-1.10-3.src.rpm

[root@pxe SPECS]# yum -y install glibc gcc perl pkgconfig zlib-devel lua-devel pcre-devel openssl-devel nss-devel

[root@pxe SPECS]# rpmbuild  -bb nginx.spec   //编译安装nginx


[root@pxe SPECS]# tree ..
..
├── BUILDROOT
├── RPMS
│   └── x86_64
│       └── nginx-1.10-3.x86_64.rpm
├── SOURCES
│   ├── conf.patch
│   ├── myconf.patch
│   ├── nginx-1.10.3.tar.gz
│   └── nginx.service
├── SPECS
│   └── nginx.spec
└── SRPMS
    └── nginx-1.10-3.src.rpm


yum 安装nginx 
[root@pxe SPECS]# cd  ../RPMS/x86_64/
[root@pxe x86_64]# ls
nginx-1.10-3.x86_64.rpm
[root@pxe x86_64]# yum  install  ./nginx-1.10-3.x86_64.rpm 

启动nginx ,查看nginx
[root@pxe x86_64]# systemctl  start nginx
[root@pxe x86_64]# ss -lntu
Netid  State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
udp    UNCONN     0      0      127.0.0.1:323                   *:*                  
tcp    LISTEN     0      128       *:80                    *:*                  
tcp    LISTEN     0      128       *:22                    *:*             

访问nginx网页:
firefox:http://192.168.1.20




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维螺丝钉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值