Embracing the Messiness in Search of Epic Solutions

RPM: Performing Offline Installation

Posted

in

PROBLEM

To perform an offline (or airgapped) installation, sometimes it’s not sufficient to download just the needed RPM package. In most cases, this package requires a list of dependencies to be installed too.

For example, Nginx requires at least 20 different packages in order for its installation to be successful:-

$ sudo yum deplist nginx
package: nginx.x86_64 1:1.16.1-1.el7
  dependency: /bin/sh
   provider: bash.x86_64 4.2.46-34.el7
  dependency: libc.so.6(GLIBC_2.17)(64bit)
   provider: glibc.x86_64 2.17-307.el7.1
  dependency: libcrypt.so.1()(64bit)
   provider: glibc.x86_64 2.17-307.el7.1
  ...
  ...
  ...
  dependency: system-logos
   provider: redhat-logos.noarch 70.7.0-1.el7
  dependency: systemd
   provider: systemd.x86_64 219-73.el7_8.8

SOLUTION

The first step to spin up an instance using the same Linux distro/version and this instance must have internet access.

Download the following yum plugin that allows the package(s) to be downloaded without installing them:-

sudo yum install yum-plugin-downloadonly

Download the needed package (in this case, Nginx) and its dependencies into a directory:-

sudo yum install --downloadonly --downloaddir=/tmp/nginx nginx

To inspect what’s being downloaded:-

$ ls -a /tmp/nginx | sort
.
..
dejavu-fonts-common-2.33-6.el7.noarch.rpm
dejavu-sans-fonts-2.33-6.el7.noarch.rpm
fontconfig-2.13.0-4.3.el7.x86_64.rpm
fontpackages-filesystem-1.44-8.el7.noarch.rpm
gd-2.0.35-26.el7.x86_64.rpm
gperftools-libs-2.6.1-1.el7.x86_64.rpm
libjpeg-turbo-1.2.90-8.el7.x86_64.rpm
libX11-1.6.7-2.el7.x86_64.rpm
libX11-common-1.6.7-2.el7.noarch.rpm
libXau-1.0.8-2.1.el7.x86_64.rpm
libxcb-1.13-1.el7.x86_64.rpm
libXpm-3.5.12-1.el7.x86_64.rpm
nginx-1.16.1-1.el7.x86_64.rpm
nginx-all-modules-1.16.1-1.el7.noarch.rpm
nginx-filesystem-1.16.1-1.el7.noarch.rpm
nginx-mod-http-image-filter-1.16.1-1.el7.x86_64.rpm
nginx-mod-http-perl-1.16.1-1.el7.x86_64.rpm
nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64.rpm
nginx-mod-mail-1.16.1-1.el7.x86_64.rpm
nginx-mod-stream-1.16.1-1.el7.x86_64.rpm
redhat-indexhtml-7-13.el7.noarch.rpm

Now, this directory can be safely compressed into a tarball to be copied to the target instance without internet access.

After extracting the tarball in the target instance, it’s time to install the package:-

sudo yum -y --disablerepo=* localinstall /tmp/nginx/*.rpm

This command is smart enough to figure out all the dependencies within the directory and install them in the proper order.

Tags:

Comments

Leave a Reply