如何使rpm自动安装依赖项 [英] How to make rpm auto install dependencies
问题描述
我已经构建了两个RPM软件包
I have built two RPM packages
-
proj1-1.0-1.x86_64.rpm
-
libtest1-1.0-1.x86_64.rpm
proj1-1.0-1.x86_64.rpm
libtest1-1.0-1.x86_64.rpm
proj1
取决于存在的文件libtest1.so
,它可以在RPM软件包中正确反映,如下所示:
proj1
depends on the file libtest1.so
being present and it is reflected correctly in the RPM packages as seen here:
user@my-pc:~$ rpm -qp --requires proj1-1.0-1.x86_64.rpm
libtest1.so()(64bit)
user@my-pc:~$ rpm -qp --provides libtest1-1.0-1.x86_64.rpm
libtest1.so()(64bit)
由于缺少依赖项,proj1
的安装失败.
The installation of proj1
fails due to a missing dependency.
user@my-pc:~$ rpm -ivh proj1-1.0-1.x86_64.rpm
error: Failed dependencies:
libtest1.so()(64bit) is needed by proj1-1.0-1.x86_64.rpm
如何确保在安装过程中自动安装libtest1-1.0-1.x86_64.rpm
proj1-1.0-1.x86_64.rpm
的安装?
How do I ensure that libtest1-1.0-1.x86_64.rpm
is installed automatically during
the installation of proj1-1.0-1.x86_64.rpm
?
我确实按照此处但这对我不起作用.
I did try the --aid
option with rpm -i
as described here but it didn't work for me.
还有其他方法吗?
感谢您的帮助.
推荐答案
创建一个(本地)存储库,并使用yum
使其为您解决依赖关系.
Create a (local) repository and use yum
to have it resolve the dependencies for you.
CentOS Wiki上有一个漂亮的页面,提供有关此操作方法的信息. CentOS Wiki HowTos/CreateLocalRepos .
The CentOS wiki has a nice page providing a how-to on this. CentOS wiki HowTos/CreateLocalRepos.
总结并进一步最小化(不理想,但最快):
Summarized and further minimized (not ideal, but quickest):
- 为您的本地存储库创建目录,例如
/home/user/repo
. - 将RPM移至该目录.
-
修复一些所有权和文件系统权限:
- Create a directory for you local repository, e.g.
/home/user/repo
. - Move the RPMs into that directory.
Fix some ownership and filesystem permissions:
# chown -R root.root /home/user/repo
安装createrepo
软件包(如果尚未安装),然后运行
Install the createrepo
package if not installed yet, and run
# createrepo /home/user/repo
# chmod -R o-w+r /home/user/repo
创建存储库配置文件,例如/etc/yum.repos.d/myrepo.repo
包含
[local]
name=My Awesome Repo
baseurl=file:///home/user/repo
enabled=1
gpgcheck=0
使用安装程序包
Install your package using
# yum install packagename
这篇关于如何使rpm自动安装依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!