How to make rpm auto install dependencies

前端 未结 11 1423
清酒与你
清酒与你 2020-12-07 07:59

I have built two RPM packages

  • proj1-1.0-1.x86_64.rpm
  • libtest1-1.0-1.x86_64.rpm

proj1 depends on

相关标签:
11条回答
  • 2020-12-07 08:00

    I found a simpler solution. If you have all the RPMs in the same directory, all you need to do is,

    $ sudo rpm -i *.rpm
    

    rpm seems to figure out the correct order to install these and installs the RPMs.

    0 讨论(0)
  • 2020-12-07 08:00

    Matthew's answer awoke many emotions, because of the fact that it still lacks a minor detail. The general command would be:

    # yum --nogpgcheck localinstall <package1_file_name> ... <packageN_file_name>
    

    The package_file_name above can include local absolute or relative path, or be a URL (possibly even an URI).

    Yum would search for dependencies among all package files given on the command line AND IF IT FAILS to find the dependencies there, it will also use any configured and enabled yum repositories.

    Neither the current working directory, nor the paths of any of package_file_name will be searched, except when any of these directories has been previously configured as an enabled yum repository.

    So in the OP's case the yum command:

    # cd <path with pkg files>; yum --nogpgcheck localinstall ./proj1-1.0-1.x86_64.rpm ./libtest1-1.0-1.x86_64.rpm
    

    would do, as would do the rpm:

    # cd <path with pkg files>; rpm -i proj1-1.0-1.x86_64.rpm libtest1-1.0-1.x86_64.rpm
    

    The differencve between these yum and rpm invocations would only be visible if one of the packages listed to be installed had further dependencies on packages NOT listed on the command line.

    In such a case rpm will just refuse to continue, while yum would use any configured and enabled yum repositories to search for dependencies, and may possibly succeed.

    The current working directory will NOT be searched in any case, except when it has been previously configured as an enabled yum repository.

    0 讨论(0)
  • 2020-12-07 08:03

    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
      
    0 讨论(0)
  • 2020-12-07 08:03

    For dnf users just use dnf install *.rpm, localinstall is no longer needed.

    0 讨论(0)
  • 2020-12-07 08:06

    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.

    0 讨论(0)
  • 2020-12-07 08:07

    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.

    0 讨论(0)
提交回复
热议问题