1. 程式人生 > >源碼包打包讓公司其他人更快的安裝

源碼包打包讓公司其他人更快的安裝

雜談 linux

拿ngixnx-1.12.2來說

1.安裝rpm-build軟件包
yum -y install rpm-build
2.生成rpmbuild目錄結構
rpmbuild -ba nginx.spec //會報錯,沒有文件或目錄報錯也要打上去 避免自己去創建文件夾 它會自己生成目錄
3.將源碼軟件復制到SOURCES目錄
cp nginx-1.12.2.tar.gz /root/rpmbuild/SOURCES/
4.創建並修改SPEC配置文件
vim /root/rpmbuild/SPECS/nginx.spec
Name:nginx //必須寫正確
Version:1.12.2 //必須寫正確

Release:10
Summary:Nginx is a web server software. //說明
Group:tearena
License:GPL
URL:www.test.com
Source0:nginx-1.12.2.tar.gz
#BuildRequires:
#Requires:
%description
nginx [engine x] is an HTTP and reverse proxy server.
%prep
%setup -q //自動解壓源碼包,並cd進入目錄
%build
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-stream --with-http_stub_status_module //自己要加載的模塊
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%files
%doc
/usr/local/nginx/* //對哪些文件進行打包
%changelog
5.安裝依賴軟件包
yum –y install gcc pcre-devel zlib-devel openssl-devel
6.rpmbuild創建RPM軟件包
rpmbuild -ba /root/rpmbuild/SPECS/nginnginx-1.12.2-10.x86_64.rpm x.spec
看一下 RPM包生成
ls /root/rpmbuild/RPMS/x86_64/
nginx-1.12.2-10.x86_64.rpm nginx-debuginfo-1.12.2-10.x86_64.rpm repodata //第一個就是生成的RPM包以後省了很多麻煩

源碼包打包讓公司其他人更快的安裝