本文讲述了制作nginx的rpm包的方法,实例如下:
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 <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. 最后执行rpmbuild命令,打rpm包
rpmbuild -bb nginx.spec
至此,执行完毕之后,rpm包就打包完成了。
更多制作nginx的rpm包教程。