如何离线安装rpm软件包及其依赖项 [英] How to install a rpm package and its dependencies offline

查看:662
本文介绍了如何离线安装rpm软件包及其依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在没有互联网连接的linux服务器上安装rpm软件包(例如python 3)及其所有依赖项。

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.

我该怎么办?

推荐答案

有一种方法,但这非常棘手,可能会弄乱您的服务器,因此请非常小心

There is a way, but it is quite tricky and might mess up your servers, so be very careful.

术语:


  • 在线:连接到存储库的系统

  • 离线 :未连接的系统

  • online : your system that is connected to the repositories
  • offline: your system that is not connected

步骤:

压缩rpm 离线系统中的数据库并将其传输到在线系统中:

Compress your rpm database from the offline system and transfer it to the online system:

cd /var/lib/rpm/
tar -cvzf /tmp/rpmdb.tgz *
scp /tmp/rpmdb.tgz root@online:/tmp

在您的在线系统上;用离线系统中的rpm数据库替换您的rpm数据库:

on your online system; replace your rpm db with the one from the offline system:

cp -r /var/lib/rpm{,.bak} # back up your rpmdb from your online system. Make sure not to lose this!!
rm -rf /var/lib/rpm/*
cd /var/lib/rpm
tar -xvf /tmp/rpmdb.tgz # now your online system pretends to have the rpm database from the offline system. Don't start really installing / uninstalling rpms or you'll break everything

现在通过下载模拟更新-only(我不是用yum而是用zypper来运行的,但是应该类似):

now simulate your update with download-only (I didn't run this with yum but with zypper, but it should be similar):

zypper up --download-only

现在,您可以获取所有已下载的软件包,它们应该足以更新您的离线系统

Now you can fetch all the downloaded packages and they should suffice for updating your offline system

现在恢复您的在线计算机:

rm -rf /var/lib/rpm
cp -r /var/lib/rpm{.bak,}

这篇关于如何离线安装rpm软件包及其依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆