1 安裝CentOS的開發環境集成包及tengine的依賴包nginx
yum groupinstall "Development Tools" yum install pcre-devel yum install openssl openssl-devel
2 建立tengine rpm包,用非root用戶testshell
su - testmkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
3 在家目錄編寫.rpmmacros(就是上一篇說的自定義製做路徑的文件)centos
#.rpmmacros %_topdir /home/test/rpmbuild %_tmppath /home/test/rpmbuild/tmp %buildroot /home/test/rpmbuild/BUILDROOT %_prefix /
4 在家目錄裏建立製做目錄rpmbuildui
rpmbuild/ ├── BUILD ├── RPMS ├── SOURCES │ └── tengine-1.5.0.tar.gz ├── SPECS │ └── tengine.spec ├── SRPMS └── tmp
5 tengine.spec內容code
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@oschina.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/
注意:在centos 6.0上使用rpmbuild製做rpm包若是出現file not found: /root/rpmbuild/BUILDROOT/…的錯誤,看是centos 6中的rpmbuild topdir已經改變,爲了能兼容centos 5的spec文件,須要對topdir進行修改ip
編輯/usr/lib/rpm/macros文件:ssl
%_topdir %{getenv:HOME}/rpmbuild 修改成: %_topdir %{_usrsrc}/
6 開始生產rpm包開發
#在test家目錄get
rpmbuild -ba ./rpmbuild/SPECS/tengine.spec
若是沒有錯誤,則會在rpmbuild/RPMS目錄下生成相關rpm包。這只是簡單的製做過程,若是要作深度定製,能夠針對安裝先後執行的腳本作定製。openssl