Saturday, October 30, 2021

[SOLVED] How to install a rpm package and its dependencies offline

Issue

I want to install a rpm package, (e.g. python 3), and all of its dependencies in a linux server that does not have internet connection.

How can I do that?


Solution

In CentOS/RedHat you can use yumdownloader for specific packages, this downloads all RPMs required, then, compress the directory, upload it to the server without Internet access and install RPMs.

Here you can find and example, installing Kubernetes without Internet access.

yumdownloader --assumeyes --destdir=/var/rpm_dir/docker-ce --resolve docker-ce
tar -czvf d4r-k8s.tar.gz /var/rpm_dir
# Upload files
scp d4r-k8s.tar.gz root@YOUR-IP:/root
# Connect to your server
ssh root@YOUR-IP
tar -xzvf /root/d4r-k8s.tar.gz -C /
# install Docker:
yum install -y --cacheonly --disablerepo=* /var/rpm_dir/docker-ce/*.rpm


Answered By - Adrian Escutia Soto