Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

CentOS 打包 tengine 製作 RPM 安裝包流程

在 CentOS 中,若希望把 tengine 打包成 RPM,可使用 rpmbuild 工具。整體流程包含準備編譯環境、建立 rpmbuild 目錄、撰寫 spec 檔,最後執行打包。

準備環境

先安裝開發工具與相依套件,並以非 root 使用者建立 rpmbuild 目錄結構。

yum groupinstall "Development Tools"

yum install pcre-devel

yum install openssl openssl-devel

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

撰寫 spec 檔

在家目錄建立 .rpmmacros 指定 topdir,並把原始碼與 tengine.spec 放入 rpmbuild 對應目錄。spec 檔需描述名稱、版本、來源、編譯與安裝方式。

Name: tengine

Version: 1.5.0

Release: 1

%prep

%build

%install

%files

開始打包

完成 spec 檔後,執行 rpmbuild -ba 即可產生 RPM。若 CentOS 6 出現 BUILDROOT 找不到的錯誤,可檢查 /usr/lib/rpm/macros 中的 _topdir 設定。

rpmbuild -ba ./rpmbuild/SPECS/tengine.spec

Copyright © Linux教程網 All Rights Reserved