制作nginx rpm包-添加第三方cache_purge插件
系统环境:CentOS6 64bit
nginx 1.4.1
cache_purge 2.1
过程如下:
# yum -y install rpm-build
# yum –y install zlib-devel pcre-devel openssl-devel gcc make //后面编译nginx 源码包需要
# wget http://nginx.org/packages/centos/6/SRPMS/nginx-1.4.1-1.el6.ngx.src.rpm
# wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
# tar –xvf ngx_cache_purge-2.1.tar.gz
# rpm -ivh nginx-1.4.1-1.el6.ngx.src.rpm
提示如下用户错误,忽略即可。
warning: group staff does not exist - using root
warning: user fabler does not exist - using root
# cd /root/rpmbuild/SOURCES/
# ll
total 780
-rw-r--r--. 1 root root 302 May 6 20:44 logrotate
-rw-r--r--. 1 root root 767107 May 6 20:44 nginx-1.4.1.tar.gz
-rw-r--r--. 1 root root 643 May 6 20:44 nginx.conf
-rwxr-xr-x. 1 root root 2777 May 6 20:44 nginx.init
-rwxr-xr-x. 1 root root 3304 May 6 20:44 nginx.suse.init
-rw-r--r--. 1 root root 98 May 6 20:44 nginx.sysconf
-rw-r--r--. 1 root root 1097 May 6 20:44 nginx.vh.default.conf
-rw-r--r--. 1 root root 454 May 6 20:44 nginx.vh.example_ssl.conf
# tar -xvf nginx-1.4.1.tar.gz
# mv ~/ngx_cache_purge-2.1 nginx-1.4.1/
# ll nginx-1.4.1
total 592
drwxr-xr-x 6 1001 1001 4096 May 31 09:50 auto
-rw-r--r-- 1 1001 1001 221428 May 6 18:26 CHANGES
-rw-r--r-- 1 1001 1001 337316 May 6 18:26 CHANGES.ru
drwxr-xr-x 2 1001 1001 4096 May 31 09:50 conf
-rwxr-xr-x 1 1001 1001 2369 May 6 18:26 configure
drwxr-xr-x 3 1001 1001 4096 May 31 09:50 contrib
drwxr-xr-x 2 1001 1001 4096 May 31 09:50 html
-rw-r--r-- 1 1001 1001 1397 May 6 18:26 LICENSE
drwxr-xr-x 2 1001 1001 4096 May 31 09:50 man
drwxr-xr-x 3 501 wheel 4096 Mar 20 01:01 ngx_cache_purge-2.1
-rw-r--r-- 1 1001 1001 49 May 6 18:26 README
drwxr-xr-x 8 1001 1001 4096 May 31 09:50 src
# tar -zcvf nginx-1.4.1.tar.gz nginx-1.4.1 //将nginx-1.4.1目录重新打包
#vi ../SPECS/nginx.spec
在make % 的./configure \ 中增加一行编译参数
--add-module=ngx_cache_purge-2.1 \
保存退出
# rpmbuild -bb SPECS/nginx.spec //从nginx.spec构建rpm包
……等待编译完成之后查看RPMS目录
# cd RPMS/x86_64/
# ll
total 3228
-rw-r--r-- 1 root root 387589 May 31 10:29 nginx-1.4.1-1.el6.ngx.x86_64.rpm
-rw-r--r-- 1 root root 2912540 May 31 10:29 nginx-debug-1.4.1-1.el6.ngx.x86_64.rpm
nginx-1.4.1-1.el6.ngx.x86_64.rpm就是已经添加了第三方插件的rpm包了
转载于:https://blog.51cto.com/songxj/1213622