Recently, tengine has been involved in CentOS 6.4. Recently, I saw how to create an rpm package, so I had the idea of creating an rpm package.
1. Install the CentOS development environment integration package and tengine dependency package
Yum groupinstall "Development Tools"
Yum install pcre-devel
Yum install openssl-devel
2. Create a tengine rpm package and use test as a non-root user.
Su-test
Mkdir-p ~ /Rpmbuild/{BUILD, RPMS, SOURCES, SPECS, SRPMS}
3. Write. rpmmacros in the Home Directory (that is, the file used to create a custom path in the previous article)
#. Rpmmacros
% _ Topdir/home/test/rpmbuild
% _ Tmppath/home/test/rpmbuild/tmp
% Buildroot/home/test/rpmbuild/BUILDROOT
% _ Prefix/
4. Create the directory rpmbuild in the Home Directory
Rpmbuild/
── BUILD
── RPMS
── SOURCES
│ ── Tengine-1.5.0.tar.gz.
── SPECS
│ ── Tengine. spec
── SRPMS
── Tmp
5 tengine. spec content
Name: tengine
Version: 1.5.0
Release: 1
Vendor: Taobao
Summary: GUN Tengine X86_64
License: GPL
Source: tengine-1.5.0.tar.gz
Group: System Enviroment/Daemons
URL: http://tengine.taobao.org/
Packager: guol@oschin.com
% Description
Taobao tengine package
% Prep
% Setup-q
./Configure -- prefix =/etc/nginx/
Make
% Install
Make DESTDIR = $ RPM_BUILD_ROOT install
% Clean
["$ RPM_BUILD_ROOT "! = "/"] & Rm-rf "$ RPM_BUILD_ROOT"
Make clean
% Files
% Defattr (-, root, root)
/Etc/nginx/
Note: Use rpmbuild to create an rpm package on centos 6.0 if File not found:/root/rpmbuild/BUILDROOT /... In centos 6, rpmbuild topdir has changed. To be compatible with centos 5 spec files, you need to modify topdir.
Edit the/usr/lib/rpm/macros file:
% _ Topdir % {getenv: HOME}/rpmbuild
To:
% _ Topdir % {_ usrsrc }/
6. Start to produce rpm packages
# In the test home directory
Rpmbuild-ba./rpmbuild/SPECS/tengine. spec
If no error occurs, the rpm package is generated in the rpmbuild/RPMS directory. This is just a simple production process. If you need in-depth customization, you can customize the scripts executed before and after installation.
Note: The above configuration file passed the test on centos6.4
Create your own rpm package
Directory structure and configuration after rpm installation in Linux
Brief Introduction and demo of rpm and yum
RedHat Linux --- rpm command details