製作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

 執行完畢之後,就打包完成了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章