Nginx package rpm, nginxrpm

Source: Internet
Author: User
Tags rpmbuild

Nginx package rpm, nginxrpm
Install rpmbuild, generate a directory, and write a spec file with your own spec file. Due to the company's needs, nginx needs to add lua and other dependent packages, and then packages the rpm through the compilation process. The red part is the Name: nginx added based on the Compilation result.
Version: 1.2.7
Release: 1% {? Dist}
Summary: A free, open-source, high-performance HTTP server and reverse proxy.

Group: System Enviroment/Daemons
License: BSD
BuildRoot: % (mktemp-ud % {_ tmppath}/% {name}-% {version}-% {release}-XXXXXX)

BuildRequires: openssl-devel, lua-devel
Requires: openssl, lua

% Description
Nginx is a free, open-source, high-performance HTTP server and reverse proxy,
As well as an IMAP/POP3 proxy server. Nginx is known for its high
Performance, stability, rich feature set, simple configuration, and low
Resource consumption.

% Prep
% Setup-q

% Build
Export DESTDIR = % {buildroot}
. /Configure -- user = www -- group = www -- prefix =/usr/local/nginx -- pid-path =/var/run/nginx. pid -- lock-path =/var/run/nginx. lock -- with-http_stub_status_module -- with-http_ssl_module -- with-http_realip_module -- with-http_perl_module -- with-pcre =/root/rpmbuild/SOURCES/pcre-8.32 -- with-debug -- add-module =/root/rpmbuild/SOURCES/lua-nginx-module-0.9.1/ -- add-module =/root/rpmbuild/SOURCES/ngx_devel_kit-0.2.19/-- add-module =/root/rpmbuild/SOURCES/echo-nginx-module-0.49/
Make % {? _ Smp_mflags}

% Pre
Id www>/dev/null 2> & 1
Var1 = 'echo $? '
If [$ var1! = 0]; then
Groupadd www>/dev/null 2> & 1
Useradd www-g www>/dev/null 2> & 1
Mkdir-p/data/logs/nginx>/dev/null 2> & 1

% Installmake install DESTDIR = % {buildroot}
Make-f/root/rpmbuild/BUILD/nginx-1.2.7/objs/Makefile installcd/root/rpmbuild/BUILD/nginx-1.2.7/objs/src/http/modules/perl & make installtest-d "% {buildroot}/usr/local/nginx" | mkdir-p "% {buildroot}/usr/local/nginx" test-d "% {buildroot}/usr/ local/nginx/sbin "| mkdir-p" % {buildroot}/usr/local/nginx/sbin "test! -F "% {buildroot}/usr/local/nginx/sbin/nginx" | mv "% {buildroot}/usr/local/nginx/sbin/nginx" "% {buildroot}/usr/local/nginx/sbin/nginx. old "cp/root/rpmbuild/BUILD/nginx-1.2.7/objs/nginx" % {buildroot}/usr/local/nginx/sbin/nginx "test-d" % {buildroot }/ usr/local/nginx/conf "| mkdir-p" %{ buildroot}/usr/local/nginx/conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/koi -win "% {buildroot}/usr/local/nginx/conf" cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/koi-utf "% {buildroot}/usr/local /nginx/conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/win-utf" % {buildroot}/usr/local/nginx/conf "test-f" % {buildroot}/usr/local/nginx/conf/mime. types "| cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/mime. types "% {buildroot}/usr/local/nginx/conf" cp/root/rpm build/nginx-1.2.7/conf/mime. types "% {buildroot}/usr/local/nginx/conf/mime. types. default "test-f" % {buildroot}/usr/local/nginx/conf/fastcgi_params "| cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/fastcgi_params" % {buildroot }/usr/local/nginx/conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/fastcgi_params" % {buildroot}/usr/local/nginx/conf/fastcgi_params.default "test -f "% {buildroot}/usr/local/nginx/conf/fastcgi. conf "| cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/fastcgi. conf "% {buildroot}/usr/local/nginx/conf" cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/fastcgi. conf "% {buildroot}/usr/local/nginx/conf/fastcgi. conf. default "test-f" % {buildroot}/usr/local/nginx/conf/uwsgi_params "| cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/uwsgi_params" % {buildroot }/usr/local/nginx/conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/uwsgi_params" % {buildroot}/usr/local/nginx/conf/uwsgi_params.default "test -f "% {buildroot}/usr/local/nginx/conf/scgi_params" | cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/scgi_params "% {buildroot}/usr /local/nginx/conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/scgi_params" % {buildroot}/usr/local/nginx/conf/scgi_params.default "test-f" % {buildroot}/usr/local/nginx/conf/nginx. conf "| cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/nginx. conf "% {buildroot}/usr/local/nginx/conf/nginx. conf "cp/root/rpmbuild/BUILD/nginx-1.2.7/conf/nginx. conf "% {buildroot}/usr/local/nginx/conf/nginx. conf. default "test-d"/var/run/nginx "| mkdir-p"/var/run/nginx "test-d" % {buildroot}/usr/local/nginx /logs "| mkdir-p" % {buildroot}/usr/local/nginx/logs "test-d" % {buildroot}/usr/local/nginx/html "| | cp-R/root/rpmbuild/BUILD/nginx-1.2.7/html "% {buildroot}/usr/local/nginx" test-d "% {buildroot}/usr/local/nginx /logs "| mkdir-p" % {buildroot}/usr/local/nginx/logs "cp/root/rpmbuild/BUILD/nginx" % {buildroot}/usr/local /nginx/conf/nginx "cp/root/rpmbuild/BUILD/nginx. conf "% {buildroot}/usr/local/nginx/conf/nginx. conf. pre "cp/root/rpmbuild/BUILD/nginx_logrotate" % {buildroot}/usr/local/nginx/conf/nginx_logrotate"
This section is obtained from the execution of make install.
% Postcp/usr/local/nginx/conf/nginx/etc/rc. d/init. d/nginx>/dev/null 2> & 1cp/usr/local/nginx/conf/nginx. conf/usr/local/nginx/conf/nginx. conf. bak>/dev/null 2> & 1cp/usr/local/nginx/conf/nginx. conf. pre/usr/local/nginx/conf/nginx. conf>/dev/null 2> & 1cp/usr/local/nginx/conf/nginx_logrotate/etc/logrotate. d/nginx>/dev/null 2> & 1 chmod a + x/etc/logrotate. d/nginx>/dev/null 2> & 1 chmod a + x/etc/rc. d/init. d/nginx>/dev/null 2> & 1 chkconfig -- add nginxchkconfig nginx on/etc/init. d/nginx start
% Preunif ps aux | grep "nginx" | grep-v grep>/dev/null; then pkill nginx>/dev/nullfichkconfig -- del nginx
% Postunuserdel wwwrm-rf/etc/rc. d/init. d/nginxrm-rf/etc/logrotate. d/nginx
% Cleanrm-rf % {buildroot} % files/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/50x.html/usr/local/nginx/html/index.html/usr/local/nginx/ sbin/nginx/usr/lib64/perl5/perllocal. pod/usr/local/lib64/perl5/auto/nginx /. packlist/usr/local/lib64/perl5/auto/nginx. bs/usr/local/lib64/perl5/auto/nginx. so/usr/local/lib64/perl5/nginx. pm/usr/local/nginx/sbin/nginx. old/usr/local/share/man/man3/nginx.3pm/usr/local/nginx/conf/nginx. conf. pre/usr/local/nginx/conf/nginx_logrotate/usr/local/nginx/conf/nginx # After rpmbuild-bb is executed, the system prompts that the missing files are added here % defattr (-, root, root,-) % doc % dir/usr/local/nginx/logs % dir/var/run/nginx
% Changelog
I want to add a module for Nginx in the online environment. The online nginx is installed in rpm mode (non-compiled installation). Can I add it?

This should be difficult, And the nginx of the rpm package is generally a red hat modified nginx, not the Community nginx. Therefore, it is generally not recommended to use rpm to install nginx, but to use manual compilation to facilitate nginx expansion in the future. If you want to increase the number, you can try the following method:
Run. /nginx-V: Check the nginx compilation options, download the nginx source code, add extensions, and re-compile nginx with the compilation options to stop the old nginx, then replace the previous nginx binary file with the newly compiled nginx, and restart nginx.

How to Create a linux rpm package

Try RPMBuilder. The open-source C ++ is based on Linux. Very easy:
> Rpmbuilder # The first execution is to generate the RPMBuilder. xml configuration file.
> Vi RPMBuilder. xml # simple configuration
> Rpmbuilder # Start Packaging
Go to the link below to download the rpm package, install it, and directly use ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.