制作nginx的RPM包

============================================================================

原创作品,允许转载。转载时请务必以超链接形式标明原始出处、以及本声明。

请注明转自:http://yunjianfei.iteye.com/blog/

============================================================================

废话不多说,直接上主题。

1. 下载nginx源码,直接运行命令:

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

 拿到源码包之后,解压,并进入目录:

tar zxvf nginx-1.7.1.tar.gz

cd nginx-1.7.1

 2. 编写SPEC文件

文件名为: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 <[email protected]>
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. 执行rpmbuild命令,打rpm包

rpmbuild -bb nginx.spec

 执行完毕之后,就打包完成了。

猜你喜欢

转载自yunjianfei.iteye.com/blog/2075590