【问题标题】:Install rpm package on amazon-linux-2 EC2 instance offline在 amazon-linux-2 EC2 实例上离线安装 rpm 包
【发布时间】:2021-08-22 14:25:29
【问题描述】:

我正在尝试通过上传所有依赖项在未连接到 Internet 的 amazon-linux-2 EC2 实例上安装 rpm 包(rstudio-server)。我主要遵循here 的指示。

使用 amazon-linux-2 docker 镜像

在我的本地机器上,在amazonlinux docker image 中,我运行:

mkdir /var/tmp/rstudio-server
mkdir /var/tmp/rstudio-server-installroot
wget https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-1.4.1106-x86_64.rpm
yum install --downloadonly --installroot=/var/tmp/rstudio-server-installroot/ --downloaddir=/var/tmp/rstudio-server rstudio-server-rhel-1.4.1106-x86_64.rpm --releasever latest

我收到此错误:

Loaded plugins: ovl, priorities
Repository 'amzn2-core': Error parsing config: Error parsing "mirrorlist = '$awsproto://$amazonlinux.$awsregion.$awsdomain/latest/$product/$target/x86_64/mirror.list'": URL must be http, ftp, file or https not ""
Repository 'amzn2-core-source': Error parsing config: Error parsing "mirrorlist = '$awsproto://$amazonlinux.$awsregion.$awsdomain/latest/$product/$target/SRPMS/mirror.list'": URL must be http, ftp, file or https not ""
Repository 'amzn2-core-debuginfo': Error parsing config: Error parsing "mirrorlist = '$awsproto://$amazonlinux.$awsregion.$awsdomain/latest/$product/$target/debuginfo/x86_64/mirror.list'": URL must be http, ftp, file or https not ""
Examining rstudio-server-rhel-1.4.1106-x86_64.rpm: rstudio-server-1.4.1106-1.x86_64
Marking rstudio-server-rhel-1.4.1106-x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rstudio-server.x86_64 0:1.4.1106-1 will be installed
--> Processing Dependency: sqlite for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: postgresql-libs for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: psmisc for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Processing Dependency: /bin/sh for package: rstudio-server-1.4.1106-1.x86_64
--> Finished Dependency Resolution
Error: Package: rstudio-server-1.4.1106-1.x86_64 (/rstudio-server-rhel-1.4.1106-x86_64)
           Requires: sqlite
Error: Package: rstudio-server-1.4.1106-1.x86_64 (/rstudio-server-rhel-1.4.1106-x86_64)
           Requires: /bin/sh
Error: Package: rstudio-server-1.4.1106-1.x86_64 (/rstudio-server-rhel-1.4.1106-x86_64)
           Requires: postgresql-libs
Error: Package: rstudio-server-1.4.1106-1.x86_64 (/rstudio-server-rhel-1.4.1106-x86_64)
           Requires: psmisc
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

如果我尝试在没有 --installroot 标志的情况下运行它,它只会创建另外两个 rpm 文件,postgresql-libspsmisc。我假设这些是直接依赖项,但它不会安装二阶依赖项。尝试对依赖项运行相同的命令没有任何作用。

使用 CentOS docker 镜像

如果我在 centos docker image 中尝试它,我可以构建 repo,但它似乎从另一边不起作用。

mkdir /var/tmp/rstudio-server
mkdir /var/tmp/rstudio-server-installroot
wget https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-1.4.1106-x86_64.rpm
yum install --downloadonly --installroot=/var/tmp/rstudio-server-installroot/ --downloaddir=/var/tmp/rstudio-server rstudio-server-rhel-1.4.1106-x86_64.rpm --releasever 8

这会在/var/tmp/rstudio-server 下创建 167 个文件。

我将它们以及原始 rstudio-server rpm 全部上传到远程机器(通过一个特殊的 S3 存储桶进行病毒扫描并将其移动到另一个 S3 存储桶),然后将所有内容下载到 /var/tmp/rstudio-server on amazon-linux-2 EC2 机器。

然后我创建一个名为/etc/yum.repos.d/offline-rstudio-server.repo 的文件,其内容如下:

[offline-rstudioserver]
name=amazon-linux-2 - rstudioserver
baseurl=file:///var/tmp/rstudio-server
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2

然后我运行:

sudo yum --disablerepo=\* --enablerepo=offline-rstudioserver install /var/tmp/rstudio-server/rstudio-server-rhel-1.4.1106-x86_64.rpm

它给了我很多信息,例如:

--> Processing Dependency: libgnutils.so.28()(64bit) for package: neon-0.30.0-3.amzn2.0.2.x86_64

然后,许多消息如下:

Error: Package: python3-libs-3.7.6-1.amzn2.0.1.x86_64 (@amzn2-core)
           Requires: libtirpc.so.1()(64bit)
           Removing: libtirpc-0.2.4-0.16.amzn2.x86_64 (@amzn2-core)
               libtirpc.so.1()(64bit)
           Updated by: libtirpc-1.1.4-4.el8.x86_64 (offline-rstudioserver)
              ~libtirpc.so.3()(64bit)

我认为这里的问题是我在 CentOS 机器上编译它并将它带到 amazon-linux-2 机器上,那里存在一些根本的不兼容。

我被正式卡住了。有什么想法吗?

【问题讨论】:

  • 离线做,你必须有主包和所有的依赖包。您可以在互联网机器上下载所有内容并将它们复制到离线机器上。
  • 这就是我想要做的。

标签: amazon-ec2 offline rpm yum rstudio-server


【解决方案1】:

豪迪

在我看来,您的 amazon linux 安装提供的 libtirpc 版本高于您的离线存储库。通过python3-libs的依赖

由于您是离线工作并且不会从互联网上获得相互冲突的更新,因此您可以尝试“让事情运行”,我不建议将其作为生产方法:P

rpm -e --justdb --nodeps libtirpc-0.2.4-0.16.amzn2.x86_64

这将具有从 rpm db 中删除该包的条目的效果,让 yum 感觉可以继续,同时实际上不会从文件系统上的包中删除任何内容(如果有,可能会破坏事情)

可能还有其他依赖关系,这可能会使事情复杂化。祝你好运。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-22
    • 1970-01-01
    • 2014-11-21
    • 1970-01-01
    • 2015-04-04
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    相关资源
    最近更新 更多