[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