1.二进制文件准备
之前已经执行源码编译工作 :configure --prefix=/opt/httpd;make;make install
2.建立build目录,并且创建nginx.spec文件:
$cd /usr/src/redhat/BUILD
$mkdir -p /usr/src/redhat/BUILD/nginx-root/opt/httpd
$cp -rpf /opt/httpd/* /usr/src/redhat/BUILD/nginx-root/opt/httpd/
$mkdir -p /usr/src/redhat/BUILD/nginx-root/etc/init.d
$cp /etc/init.d/httpd /usr/src/redhat/BUILD/nginx-root/etc/init.d/
$touch nginx.spec
Summary: Nginx Server
Name: nginx
Version: 0.6.3
Release: 1
License: GPL
Group: Development/Tools
BuildRoot: %{_builddir}/%{name}-root
#BuildRoot: /usr/src/redhat/BUILD/nginx-root
%description
Nginx Server install rpm page
Requires: zlib >= 1.2.3 zlib-devel >= 1.2.3 openssl
%files
/opt/httpd
/etc/init.d/httpd
%pre
if [ -f /etc/init.d/httpd ];then
chkconfig --del httpd
fi
%post
chkconfig --add httpd
chkconfig --level 35 httpd on
chkconfig --level 01246 httpd off
%preun
chkconfig --del httpd
rm -f /etc/init.d/httpd
4.生成nginx-0.6.3-1.i386.rpm \nginx-0.6.3-1.x86_64.rpm
$rpmbuild -bb nginx.spec --nodeps
/usr/src/redhat/RPMS/i386/nginx-0.6.3-1.i386.rpm # 32位系统生成文件存储位置
/usr/src/redhat/RPMS/x86_64/nginx-0.6.3-1.x86_64.rpm # 64位系统生成文件存储位置
5.安装测试
将安装包拷贝到测试机器上执行
$rpm -ivh nginx-0.6.3-1.i386.rpm
程序已经发布到/opt/httpd/目录下
查询安装
$rpm -qa|grep nginx
nginx-0.6.3-1
卸载
$rpm -e nginx
/opt/httpd/目录,/etc/init.d/httpd文件被清除.
阅读(1265) | 评论(0) | 转发(0) |