且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何离线安装 rpm 包及其依赖项

更新时间:2022-12-12 20:32:47

在 CentOS/RedHat 中你可以使用 yumdownloader 获取特定的包,这会下载所有需要的 RPM,然后,压缩目录,上传到没有 Internet 访问权限的服务器并安装 RPM.

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.

这里 你可以找到示例,在没有 Internet 访问的情况下安装 Kubernetes.

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