rpm과 yum 모두 URL을 직접 지정하여 설치할 수 있습니다.

rpm과 yum 모두 URL을 직접 지정하여 설치할 수 있습니다.

2022-10-04 last update

8 minutes reading Yum RHEL 리눅스 CentOS rpm

wget 이나 curl 로 다운로드하고 나서 rpm or yum 하는 것은 두 번 번거롭다고 생각하지 않습니까?



예를 들어, RedHat Enterprise Linux에 epel 리포지토리를 추가하는 단계로서 다음과 같은 방법을 소개하고 있는 것을 보거나 합니다만, 원래 한 번으로 할 수 없는 것이라고 생각하네요.
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm

실은 rpm도 yum도 URL 지정으로 인스톨 할 수 있어요



다운로드한 rpm 의 해시를 수작업으로 검증하거나 인터넷 측과 직접 통신할 수 없는 장비라면 어쨌든, 그렇지 않으면 URL 지정으로 한 번에 설치하는 편이 간단해집니다.

다만 지정하는 URL의 신뢰성은 미리 확인해 두어야 합니다.

예를 들어 rpm 예



의존 패키지가 없는 경우는 이것으로 갈 수 있습니다.
$ sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm を 取得中
警告: /var/tmp/rpm-tmp.WoLaxZ: ヘッダー V3 RSA/SHA256 Signature、鍵 ID 352c64e5: NOKEY
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:epel-release-7-9                 ################################# [100%]
$

또는 yum 예제



yum의 경우는 의존 패키지를 자동적으로 추가 인스톨 해 주기 때문에, 통상은 이쪽을 사용하면 좋다.
$ sudo yum install http://ftp.riken.jp/Linux/centos/7.5.1804/updates/x86_64/Packages/gcc-4.8.5-28.el7_5.1.x86_64.rpm
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, ovl
gcc-4.8.5-28.el7_5.1.x86_64.rpm                                                                                          |  16 MB  00:00:03     
Examining /var/tmp/yum-root-utmdtS/gcc-4.8.5-28.el7_5.1.x86_64.rpm: gcc-4.8.5-28.el7_5.1.x86_64
Marking /var/tmp/yum-root-utmdtS/gcc-4.8.5-28.el7_5.1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be installed
--> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
--> Processing Dependency: libgomp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Processing Dependency: libmpfr.so.4()(64bit) for package: gcc-4.8.5-28.el7_5.1.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package glibc-devel.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: glibc-headers = 2.17-222.el7 for package: glibc-devel-2.17-222.el7.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-222.el7.x86_64
---> Package libgomp.x86_64 0:4.8.5-28.el7_5.1 will be installed
---> Package libmpc.x86_64 0:1.0.1-3.el7 will be installed
---> Package mpfr.x86_64 0:3.1.1-4.el7 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.17-222.el7 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-222.el7.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.17-222.el7.x86_64
--> Running transaction check
---> Package kernel-headers.x86_64 0:3.10.0-862.11.6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================
 Package                        Arch                   Version                               Repository                                    Size
================================================================================================================================================
Installing:
 gcc                            x86_64                 4.8.5-28.el7_5.1                      /gcc-4.8.5-28.el7_5.1.x86_64                  37 M
Installing for dependencies:
 cpp                            x86_64                 4.8.5-28.el7_5.1                      updates                                      5.9 M
 glibc-devel                    x86_64                 2.17-222.el7                          base                                         1.1 M
 glibc-headers                  x86_64                 2.17-222.el7                          base                                         678 k
 kernel-headers                 x86_64                 3.10.0-862.11.6.el7                   updates                                      7.1 M
 libgomp                        x86_64                 4.8.5-28.el7_5.1                      updates                                      156 k
 libmpc                         x86_64                 1.0.1-3.el7                           base                                          51 k
 mpfr                           x86_64                 3.1.1-4.el7                           base                                         203 k

Transaction Summary
================================================================================================================================================
Install  1 Package (+7 Dependent packages)

Total size: 53 M
Total download size: 15 M
Installed size: 60 M
Is this ok [y/d/N]: 

익숙한 것을 rpm으로 하면 이렇게 됩니다. 의존하는 패키지가 있다는 것을 가르쳐 주지만, 그 이상의 팔로우는 없는 것입니다.
$ sudo rpm -ivh http://ftp.riken.jp/Linux/centos/7.5.1804/updates/x86_64/Packages/gcc-4.8.5-28.el7_5.1.x86_64.rpm
Retrieving http://ftp.riken.jp/Linux/centos/7.5.1804/updates/x86_64/Packages/gcc-4.8.5-28.el7_5.1.x86_64.rpm
error: Failed dependencies:
    cpp = 4.8.5-28.el7_5.1 is needed by gcc-4.8.5-28.el7_5.1.x86_64
    glibc-devel >= 2.2.90-12 is needed by gcc-4.8.5-28.el7_5.1.x86_64
    libgomp = 4.8.5-28.el7_5.1 is needed by gcc-4.8.5-28.el7_5.1.x86_64
    libgomp.so.1()(64bit) is needed by gcc-4.8.5-28.el7_5.1.x86_64
    libmpc.so.3()(64bit) is needed by gcc-4.8.5-28.el7_5.1.x86_64
    libmpfr.so.4()(64bit) is needed by gcc-4.8.5-28.el7_5.1.x86_64