【问题标题】:Can I install different packages from my own rpm-package?我可以从我自己的 rpm 包中安装不同的包吗?
【发布时间】:2016-03-16 01:37:06
【问题描述】:

我可以在 CentOS 7 上从我自己的 rpm-package 安装不同的软件包(这是我的任务,其他变体,如 shell-script 被拒绝)?我正在尝试了解 rpmbuild 的规范文件格式,因此我使用了该文件的一些最小配置。我正在创建一个 rpm 包(我们称之为 test.rpm),使用“rpm -i test.rpm”启动它,并看到来自 %post 的“yum install”已启动,但停留在“运行事务”级别安装。 SELINUX 被禁用。

这是我的 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 <test@test.com>
- 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.

这就是所有的输出。未安装软件包。请帮我。谢谢。

【问题讨论】:

  • 您是否尝试使用yum install test.rpm 而不是rpm -i test.rpm?这些情况也应在规范文件的Requires 部分声明。
  • 是的,只是忘记添加了。那是“yum install test.rpm”输出的结尾: Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction正在安装:test_script_name-0.1-1.noarch
  • 这种方式后没有安装lync包?

标签: linux rpm rpmbuild


【解决方案1】:

如果您将此包定义为需求:

Requires: lynx

然后会在下面的命令之后作为依赖安装:

yum localinstall test.rpm

look the question about autoinstallation dependencies

【讨论】:

  • 真的,只要尝试在“Requires”部分添加包,包就安装好了!现在有对话框(这可以吗[y/d/N]:),但没关系,我正在尝试处理它。谢谢。
  • install 在这一点上与localinstall 的工作方式相同。不再需要使用localinstall
【解决方案2】:

解决 OP 的问题:不,您不能从另一个 rpm 安装一个 rpm。为了做你想做的事,你可以使用Requires标签将其他包列为依赖

进一步阅读:

这里讨论 RPM 依赖项:

作为一项规则,您应该使用yum 来安装(甚至是本地构建的包),以使其数据库保持最新。

【讨论】:

  • 谢谢,对我很有用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-08
  • 1970-01-01
  • 2013-04-04
  • 1970-01-01
  • 2020-12-20
相关资源
最近更新 更多