159

2 つの RPM パッケージをビルドしました

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

proj1存在するファイルに依存し、次にlibtest1.so示すように RPM パッケージに正しく反映されます。

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失敗します。

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ですか?

ここで説明されているように--aidオプションを試しましたが、うまくいきませんでした。rpm -i

他に方法はありますか?

助けてくれてありがとう。

4

12 に答える 12

114

(ローカル) リポジトリを作成し、yumそれを使用して依存関係を解決します。

CentOS wiki には、これに関するハウツーを提供する素晴らしいページがあります。CentOS wiki HowTos/CreateLocalRepos


要約してさらに最小化します (理想的ではありませんが、最速です):

  1. ローカル リポジトリ用のディレクトリを作成します/home/user/repo
  2. RPM をそのディレクトリに移動します。
  3. いくつかの所有権とファイル システムのアクセス許可を修正します。

    # chown -R root.root /home/user/repo
    
  4. createrepoまだインストールされていない場合はパッケージをインストールし、実行します

    # createrepo /home/user/repo
    # chmod -R o-w+r /home/user/repo
    
  5. /etc/yum.repos.d/myrepo.repoを含むリポジトリ構成ファイルを作成します。

    [local]
    name=My Awesome Repo
    baseurl=file:///home/user/repo
    enabled=1
    gpgcheck=0
    
  6. を使用してパッケージをインストールします

    # yum install packagename
    
于 2012-12-14T11:24:07.013 に答える
33

dnf ユーザーの場合は、 , を使用するだけdnf install *.rpmで、localinstall不要になりました。

于 2015-08-20T18:05:23.467 に答える
29

私にとってはちょうど一緒に働いた

# yum install ffmpeg-2.6.4-1.fc22.x86_64.rpm

そして、依存関係をダウンロードするための承認を自動的に求めました。以下の例では、fedora 22 を使用しています。

[root@localhost lukas]# yum install ffmpeg-2.6.4-1.fc22.x86_64.rpm
Yum command has been deprecated, redirecting to '/usr/bin/dnf install  ffmpeg-2.6.4-1.fc22.x86_64.rpm'.
See 'man dnf' and 'man yum2dnf' for more information.
To transfer transaction metadata from yum to DNF, run:
'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'

Last metadata expiration check performed 0:28:24 ago on Fri Sep 25 12:43:44 2015.
Dependencies resolved.
====================================================================================================================
 Package               Arch           Version                                  Repository                      Size
====================================================================================================================
Installing:
 SDL                   x86_64         1.2.15-17.fc22                           fedora                         214 k
 ffmpeg                x86_64         2.6.4-1.fc22                             @commandline                   1.5 M
 ffmpeg-libs           x86_64         2.6.4-1.fc22                             rpmfusion-free-updates         5.0 M
 fribidi               x86_64         0.19.6-3.fc22                            fedora                          69 k
 lame-libs             x86_64         3.99.5-5.fc22                            rpmfusion-free                 345 k
 libass                x86_64         0.12.1-1.fc22                            updates                         85 k
 libavdevice           x86_64         2.6.4-1.fc22                             rpmfusion-free-updates          75 k
 libdc1394             x86_64         2.2.2-3.fc22                             fedora                         124 k
 libva                 x86_64         1.5.1-1.fc22                             fedora                          79 k
 openal-soft           x86_64         1.16.0-5.fc22                            fedora                         292 k
 opencv-core           x86_64         2.4.11-5.fc22                            updates                        1.9 M
 openjpeg-libs         x86_64         1.5.1-14.fc22                            fedora                          89 k
 schroedinger          x86_64         1.0.11-7.fc22                            fedora                         315 k
 soxr                  x86_64         0.1.2-1.fc22                             updates                         83 k
 x264-libs             x86_64         0.142-12.20141221git6a301b6.fc22         rpmfusion-free                 587 k
 x265-libs             x86_64         1.6-1.fc22                               rpmfusion-free                 486 k
 xvidcore              x86_64         1.3.2-6.fc22                             rpmfusion-free                 264 k

Transaction Summary
====================================================================================================================
Install  17 Packages

Total size: 11 M
Total download size: 9.9 M
Installed size: 35 M
Is this ok [y/N]: y
于 2015-09-25T18:18:40.117 に答える
5

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.

于 2018-01-30T08:54:52.200 に答える
1

openSUSE Leap 15 の場合、同様のエラーが表示されます。

> 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

このコマンドを実行して、依存関係を把握します。

> 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

次に、次のコマンドを実行して依存関係をインストールします。

> 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

次に、これを実行してファイルをインストールしrpmます。

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

それがベストプラクティスかどうかはわかりませんが、問題は解決しました

于 2018-06-09T06:33:59.233 に答える
0

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.

于 2016-02-05T01:26:10.897 に答える
-2

次のコマンドを実行するだけです。

sudo dnf install *package.rpm

パスワードを入力して完了です。

于 2018-03-30T03:06:38.123 に答える