How to make rpm auto install dependencies

2019-01-16 01:24发布

I have built two RPM packages

  • proj1-1.0-1.x86_64.rpm
  • libtest1-1.0-1.x86_64.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)

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

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.

Is there any other way?

Thanks for any help.

11条回答
相关推荐>>
2楼-- · 2019-01-16 01:56

The link @gertvdijk provided shows a quick way to achieve the desired results without configuring a local repository:

$ yum --nogpgcheck localinstall packagename.arch.rpm

Just change packagename.arch.rpm to the RPM filename you want to install.

Edit Just a clarification, this will automatically install all dependencies that are already available via system YUM repositories.

If you have dependencies satisfied by other RPMs that are not in the system's repositories, then this method will not work unless each RPM is also specified along with packagename.arch.rpm on the command line.

查看更多
三岁会撩人
3楼-- · 2019-01-16 01:57

In the case of openSUSE Leap 15, I'm receiving similar error:

> sudo rpm -i opera-stable_53.0.2907.68_amd64.rpm 
[sudo] password for root: 
warning: opera-stable_53.0.2907.68_amd64.rpm: Header V4 RSA/SHA512 Signature, key ID a5c7ff72: NOKEY
error: Failed dependencies:
    at is needed by opera-stable-53.0.2907.68-0.x86_64

I run this command to figure out what are the dependencies:

> sudo zypper install opera-stable_53.0.2907.68_amd64.rpm 
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 4 NEW packages are going to be installed:
  at libfl2 libHX28 opera-stable

4 new packages to install.
Overall download size: 50.3 MiB. Already cached: 0 B. After the operation, additional 176.9 MiB will be used.
Continue? [y/n/...? shows all options] (y): n

Then I run this command to install dependencies:

> sudo zypper in at
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  at libfl2 libHX28

3 new packages to install.
Overall download size: 208.6 KiB. Already cached: 0 B. After the operation, additional 600.4 KiB will be used.
Continue? [y/n/...? shows all options] (y): y

Then I run this to install the rpm file:

> sudo rpm -i opera-stable_53.0.2907.68_amd64.rpm

I'm not sure if it is the best practice, however it solved my issue.

查看更多
叼着烟拽天下
4楼-- · 2019-01-16 02:01

Simple just run the following command.

sudo dnf install *package.rpm

Enter your password and you are done.

查看更多
相关推荐>>
5楼-- · 2019-01-16 02:03

I ran into this and what worked for me was to run yum localinstall enterPkgNameHere.rpm from inside the directory where the .rpm file is located.

Note: replace the enterPkgNameHere.rpm with the name of your .rpm file.

查看更多
戒情不戒烟
6楼-- · 2019-01-16 02:04

Create a (local) repository and use yum to have it resolve the dependencies for you.

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. 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
    
  4. Install the createrepo package if not installed yet, and run

    # createrepo /home/user/repo
    # chmod -R o-w+r /home/user/repo
    
  5. Create a repository configuration file, e.g. /etc/yum.repos.d/myrepo.repo containing

    [local]
    name=My Awesome Repo
    baseurl=file:///home/user/repo
    enabled=1
    gpgcheck=0
    
  6. Install your package using

    # yum install packagename
    
查看更多
登录 后发表回答