Recently a lot of friends asked how to make the RPM package, you can not compile the other server on the software directory complex to other servers directly apply and so on ... Here is a simple introduction, advanced complex does not.
This method uses Rpmbuild to complete an RPM package by writing a spec file.
Take Nginx as an example to introduce
Production platform: CentOS 5.x x86_64
Four Step walk:
The first step: building the directory structure
MKDIR/USR/SRC/REDHAT/{SOURCES,SPECS,BUILD,RPMS,SRPMS}-P
Related Directory Introduction:
/usr/src/redhat/sources #存放源代码, patches and other documents
/usr/src/redhat/specs #存放用于管理rpm制作进程的spec文件
/usr/src/ Redhat/build #解压后的文件存放目录
/usr/src/redhat/rpms #存放由rpmbuild制作好的二进制包
/usr/src/redhat/srpms # Store the source package made by Rpmbuild
Step two: Put the source package in the sources directory
Cd/usr/src/redhat/sources
wget http://nginx.org/download/nginx-1.2.0.tar.gz
Step three: Generate Nginx.spec files
cd/usr/src/redhat/specs Cat Nginx.spec # spec file for Nginx # builds 2012-07-17 # by Opsren # Summary:high Performance Web server Name:nginx version:1.2 release:0.el5.ngx license:2-clause Bsd-like License Group:applications/server source:http://nginx.org/download/nginx-1.2.0.tar.gz url:http://
nginx.org distribution:centos/redhat Packager:qiuzhijun <250621008@qq.com>%description
Nginx ("Engine X") is a high performance HTTP and reverse proxy server, as as a mail (IMAP/POP3/SMTP) proxy server. %prep tar zxf $RPM _source_dir/nginx-1.2.0.tar.gz%build cd nginx-1.2.0./configure--prefix=/usr/local/ Webserver/nginx--with-http_stub_status_module--with-http_ssl_module--with-pcre--lock-path=/var/run/nginx.lock- -pid-path=/var/run/nginx.pid make%install cd nginx-1.2.0 make install%preun if [-Z ' PS aux | grep Nginx | Grep-v grep ' "];theN pkill nginx >/dev/null exit 0 fi%files/usr/local/webserver/nginx