2015-12-10 60 views
0

我可以在CentOS 7上從我自己的rpm-package(這是我的任務,其他變體,如shell腳本被拒絕)安裝不同的軟件包嗎?我試圖理解rpmbuild的spec文件格式,所以我使用這個文件的一些最小配置。我創建了一個rpm包(我們稱之爲test.rpm),使用「rpm -i test.rpm」啓動它,並看到%post的「yum install」啓動,但卡在「Running transaction」級別安裝。 SELINUX被禁用。我可以從我自己的rpm包安裝不同的軟件包嗎?

這裏是我的test.spec:

Name: test_script_name 
Summary: It's just a test_script_summary 
Version: 0.1 
Release: 1 
Group: Applications/Internet 
License: GPL 
BuildArch: noarch 

%description 
A test_script_description. 

%prep 

%build 

%install 

%clean 

%post 
yum install -y lynx 

%files 
%defattr(-,root,root) 

%changelog 
* Tue Dec 08 2015 test test <[email protected]> 
- test_script_changelog! 

我建立我test.rpm有:

rpmbuild --bb test.spec 

與啓動它:

rpm -i test.rpm 

這裏是一個在安裝過程中顯示的yum輸出的一部分:

Total download size: 1.5 M 
Installed size: 5.4 M 
Downloading packages: 
(1/2): centos-indexhtml-7-9.el7.centos.noarch.rpm            | 92 kB 00:00:00  
(2/2): lynx-2.8.8-0.3.dev15.el7.x86_64.rpm              | 1.4 MB 00:00:00  
----------------------------------------------------------------------------------------------------------------------- 
Total                     2.4 MB/s | 1.5 MB 00:00:00  
Running transaction check 
Running transaction test 
Transaction test succeeded 
Running transaction 
Warning: RPMDB altered outside of yum. 

這就是所有的輸出。軟件包沒有安裝。請幫幫我。謝謝。

+1

您是否嘗試使用'''yum install test.rpm'''而不是''rpm -i test.rpm'''?另外這些情況應該在''''Requires'''節中聲明規範文件。 – Sild

+0

是的,只是忘了添加它。這是「百勝安裝test.rpm」輸出結束:下載包: 運行的事務檢查 運行的事務測試 交易測試成功 運行的事務 \t安裝:test_script_name-0.1-1.noarch –

+0

的Lync包沒有安裝後這條路? – Sild

回答

2

如果你定義了這個包的要求:

Requires: lynx 

然後將安裝爲以下命令後的依賴性:

yum localinstall test.rpm 

look the question about autoinstallation dependencies

+0

真的,只需嘗試在「需求」部分添加軟件包並安裝了軟件包!現在用對話框(這是好的[y/d/N] :),但沒關係,我試圖處理它。謝謝。 –

+0

'install'在這一點上與'localinstall'的作用相同。沒有必要再使用'localinstall'。 –

2

尋址OP的問題:沒有,你不能在另一個rpm內安裝一個rpm。要做你想做的事,你可以使用Requires標籤列出其他包爲依賴項

進一步閱讀:

RPM相關這裏討論:

通常,您應該使用yum來安裝(即使是本地構建的包)以保持其數據庫處於最新狀態。

+0

謝謝,這對我真的很有用。 –

相關問題