rpm打包

1.安裝打包軟件rpm-build

yum -y install rpm-build

  1. 生成rpmbuild目錄結構 (也可以自己手動創建,建議打命令)

    rpmbuild -ba nginx.spec

                    #ls /root/rpmbuild    
                    BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
     SOURCES    #源碼

    BUILDROOT #假根
    RPMS #成品打好的包
    SPECS #配置文件

3.將源碼包複製到SOURCES目錄下

cp /root/lnmp_soft/nginx-1.8.0.tar.gz /root/rpmbuild/SOURCES/

4.cd到SPECS目錄下

cd /root/rpmbuild/SPECS/

         #vim    nginx.spec        #新建以.spec結尾的文件,進入修改配置
              Name:nginx    #軟件名

Version:1.8.0 #軟件版本
Release:10 #打包次數
Summary:this is a web server. #簡單描述

Group: #軟件組
License:GPL #協議
URL:www.zll.org #網址
Source0:nginx-1.8.0.tar.gz #源碼文件

BuildRequires: #編譯是依賴包
Requires: #安裝時依賴包

%description #詳細描述
this is a web server

%prep #安裝前準備,解壓
%setup -q #系統使用setup自動解壓,cd 安靜模式

%build #編譯需要執行的命令
./configure #可以指定安裝的模塊
make %{?_smp_mflags}

%install #安裝時需要執行的指令
make install DESTDIR=%{buildroot}

%files #定義打包文件列表
%doc
/usr/local/nginx/*

%changelog #軟件修改歷史

5.安裝依賴包

yum -y install gcc pcre-devel openssl-devel

6.打包
[root@web100 SPECS]# rpmbuild -ba nginx.spec

 # cd /root/rpmbuild/RPMS/x86_64/
 # ls

nginx-1.8.0-10.x86_64.rpm

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章