0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dnfコマンドでRPMファイルをダウンロードする

Posted at

What's?

タイトル通り。

パッケージのRPMファイルを簡単にダウンロードする方法が知りたいな、と。

環境

CentOS 8で確認します。

$ cat /etc/redhat-release
CentOS Linux release 8.4.2105


$ uname -srvmpio
Linux 4.18.0-305.12.1.el8_4.x86_64 #1 SMP Wed Aug 11 01:59:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

RPMファイルをダウンロードする

これは、dnf downloadで簡単に実現できます。

Apacheを例に。

$ dnf download httpd
Last metadata expiration check: 0:38:55 ago on 2021年08月26日 22時50分47秒.
httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm                                                                                      7.2 MB/s | 1.4 MB     00:00    

取得したRPMファイル。

$ ll httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm
-rw-rw-r--. 1 xxxxx xxxxx 1466539  8月 26 23:29 httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm

ダウンロードするファイルについては、もうちょっと指定することもできます。

ヘルプを見てみましょう。

$ dnf download --help

downloadに関するオプションは、こちら。

Download command-specific options:
  --source              download the src.rpm instead
  --debuginfo           download the -debuginfo package instead
  --debugsource         download the -debugsource package instead
  --arch [arch], --archlist [arch]
                        limit the query to packages of given architectures.
  --resolve             resolve and download needed dependencies
  --alldeps             when running with --resolve, download all dependencies
                        (do not exclude already installed ones)
  --url, --urls         print list of urls where the rpms can be downloaded
                        instead of downloading
  --urlprotocols {http,https,rsync,ftp}
                        when running with --url, limit to specific protocols

たとえば--sourceオプションを付与すると

$ dnf download --source httpd

src.rpmがダウンロードされます。

enabling appstream-source repository
enabling baseos-source repository
enabling extras-source repository
enabling epel-modular-source repository
enabling epel-source repository
CentOS Linux 8 - BaseOS - Source                                                                                                            121 kB/s | 350 kB     00:02    
CentOS Linux 8 - AppStream - Source                                                                                                         358 kB/s | 841 kB     00:02    
CentOS Linux 8 - Extras - Source                                                                                                            4.6 kB/s | 7.6 kB     00:01    
Extra Packages for Enterprise Linux Modular 8 - x86_64 - Source                                                                              16 kB/s |  14 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64 - Source                                                                                     4.4 MB/s | 2.1 MB     00:00    
httpd-2.4.37-39.module_el8.4.0+778+c970deab.src.rpm
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?