如何使 rpm 自动安装依赖项 [英] How to make rpm auto install dependencies

查看:49
本文介绍了如何使 rpm 自动安装依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了两个 RPM 包

I have built two RPM packages

  • 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?

我确实尝试了 --aid 选项和 rpm -i 描述的 这里 但它对我不起作用.

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):

  1. 为您的本地存储库创建一个目录,例如/home/user/repo.
  2. 将 RPM 移至该目录.
  3. 修复一些所有权和文件系统权限:

  1. Create a directory for you local repository, e.g. /home/user/repo.
  2. Move the RPMs into that directory.
  3. Fix some ownership and filesystem permissions:

# chown -R root.root /home/user/repo

  • 如果还没有安装createrepo包,然后运行

    # 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屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆