Home >php教程 >PHP开发 >Tutorial on making nginx RPM package

Tutorial on making nginx RPM package

高洛峰
高洛峰Original
2017-01-07 14:04:212223browse

This article describes the method of making nginx RPM package. The examples are as follows:

1. Download the nginx source code and run the command directly:

cd /root
wget http://nginx.org/download/nginx-1.7.1.tar.gz

After getting the source code package, unzip it and enter the directory:

tar zxvf nginx-1.7.1.tar.gz
cd nginx-1.7.1

2. Write the SPEC file

The file name is: nginx .spec

Summary: High Performance Web Server
Name: nginx
Version: 1.7.1
Release: el5
License: GPL
Group: Applications/Server
Source: http://nginx.org/download/nginx-%{version}.tar.gz
URL: http://nginx.org/
Distribution: Linux
Packager: yunjianfei <yunjianfei1987@gmail.com>
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
%define srcdir /root/nginx-1.7.1
%description
nginx [engine x] is a HTTP and reverse proxy server, as well as a mail proxy server
%prep
%build
cd %{srcdir}
./configure --prefix=/usr/local/nginx
make -j8
%install
cd %{srcdir}
make DESTDIR=%{buildroot} install
%preun
if [ -z "`ps aux | grep nginx | grep -v grep`" ];then
 killall nginx >/dev/null
 exit 0
fi
%files
/usr/local/nginx

3. Finally execute the rpmbuild command and create the rpm package

rpmbuild -bb nginx.spec

At this point, after the execution is completed, the rpm package is packaged.

For more articles related to the RPM package tutorial for making nginx, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn