How to make the RPM package

Source: Internet
Author: User

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 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.