制作nginxrpm包:_万金油_新浪博客

安装制作软件:
yum  -y install  rpm-build

[root@lv1 ~]# ls /root/rpmbuild/
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS


把源码包,拷贝到该目录下:
cp nginx-1.12.2.tar.gz  /root/rpmbuild/SOURCES/


vim /root/rpmbuild/SPECS/nginx.spec
Name:nginx
Version:1.12.2
Release:  10
Summary:Nginx is a web server software.

#Group:
License:GPL
URL:    www.test.com
Source0:nginx-1.12.2.tar.gz

#BuildRequires: 
#Requires:      

scription
nginx [engine x] is an HTTP and reverse proxy server.

%prep
%setup -q       //自动解压源码包,并cd进入目录


%build
./configure
make %{?_smp_mflags}

%install

make install DESTDIR=%{buildroot}


%files
%doc

/usr/local/nginx/*        //对哪些文件与目录打包


%changelog


安装相关的依赖包:
yum  -y install  gcc pcre-devel zlib-devel openssl-devel


打包源码包:
rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec 

查看已经打包的rpm包:
[root@lv1 ~]# ls /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm

查看已经打包的rpm包的基本信息:
[root@lv1 ~]#  rpm -qpi /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm
Name        : nginx
Version     : 1.12.2
Release     : 10
Architecture: x86_64
Install Date: (not installed)
Group       : Unspecified
Size        : 739541
License     : GPL
Signature   : (none)
Source RPM  : nginx-1.12.2-10.src.rpm
Build Date  : 2018年08月30日 星期四 15时42分22秒
Build Host  : lv1
Relocations : (not relocatable)
URL         : www.test.com
Summary     : Nginx is a web server software.
Description :
nginx [engine x] is an HTTP and reverse proxy server
rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec 

查看rpm的相关的配置参数:
[root@lv1 ~]# rpm -qpl /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm
/usr/local/nginx/conf
/usr/local/nginx/conf/fastcgi.conf
/usr/local/nginx/conf/fastcgi.conf.default
/usr/local/nginx/conf/fastcgi_params
/usr/local/nginx/conf/fastcgi_params.default
/usr/local/nginx/conf/koi-utf
/usr/local/nginx/conf/koi-win
/usr/local/nginx/conf/mime.types
/usr/local/nginx/conf/mime.types.default
/usr/local/nginx/conf/nginx.conf
/usr/local/nginx/conf/nginx.conf.default
/usr/local/nginx/conf/scgi_params
/usr/local/nginx/conf/scgi_params.default
/usr/local/nginx/conf/uwsgi_params
/usr/local/nginx/conf/uwsgi_params.default
/usr/local/nginx/conf/win-utf
/usr/local/nginx/html
/usr/local/nginx/html/50x.html
/usr/local/nginx/html/index.html
/usr/local/nginx/logs
/usr/local/nginx/sbin
/usr/local/nginx/sbin/nginx

安装打包的rpm包:
[root@lv1 ~]# rpm -ivh /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:nginx-1.12.2-10                  ################################# [100%]
[root@lv1 ~]# rpm -qa | grep nginx
nginx-1.12.2-10.x86_64

检查nginx是否已经安装:
rpm -qa | grep nginx

启动nginx的服务:
/usr/local/nginx/sbin/nginx 
##如果有httpd暂用了80端口需要关闭: systemctl  stop httpd

访问本机的web页面:
curl http://127.0.0.1


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

运维螺丝钉

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

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

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

打赏作者

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

抵扣说明:

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

余额充值