redhat8安装yum命令

只是想在nexus提供的docker中安装一些软件,但是没想到居然是个白板系统,只能通过npm安装软件。。。

1.确认系统版本

uname -a
# Linux sonatype-nexus31 4.4.180+ #42661 SMP Fri Apr 1 15:33:06 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

# 红帽专属查询
cat /etc/redhat-release
# Red Hat Enterprise Linux release 8.7 (Ootpa)

2.安装

问题主要来源于rpm的包不太好找,可以按需安装,如果是和我一样的白板系统,可以直接安装以下包

# yum
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/yum-4.7.0-4.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/yum-utils-4.0.21-3.el8.noarch.rpm

# lrzsz sz rz 下载上传工具
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/lrzsz-0.12.20-43.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/libnsl-2.28-164.el8.x86_64.rpm

# vi工具
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/vim-minimal-8.0.1763-16.el8.x86_64.rpm

# 执行yum是会发现缺少一些python模块,可按需安装
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-dnf-4.7.0-4.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-dnf-plugin-post-transaction-actions-4.0.21-3.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-dnf-plugins-core-4.0.21-3.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-dnf-plugin-versionlock-4.0.21-3.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-libdnf-0.63.0-3.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-rpm-4.14.3-19.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-hawkey-0.63.0-3.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-libcomps-0.1.16-2.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/libcomps-0.1.16-2.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/gpgme-1.13.1-9.el8.x86_64.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-pip-wheel-9.0.3-20.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/platform-python-pip-9.0.3-20.el8.noarch.rpm
rpm -ivh --nodeps https://mirrors.aliyun.com/centos/8.5.2111/BaseOS/x86_64/os/Packages/python3-gpg-1.13.1-9.el8.x86_64.rpm

对于python模块,也可以使用pip对其进行安装
先找到python 通过yum找到对应的python 因为没有配置python软链,所以需要此步骤

# 查找python路径(如果执行yum还有反应的话)
vi /usr/bin/yum
#!/usr/libexec/platform-python
# 使用python中的pip进行安装
/usr/libexec/platform-python -m pip install gpg

扩展-yum源更换

因为红帽默认yum也是需要收费的,所以还需要切换为阿里云,可以参考此文章进行后续处理
RedHat-8.0配置yum仓库(在线安装)

ps:

如果需要安装包,也可以直接下载包使用下载地址

也可以自己去阿里云下载,因为过一段时间可能会被清除,所以需要自己去按目录进行查找
https://mirrors.aliyun.com/centos/版本/BaseOS/x86_64/os/Packages/***.rpm

你可能感兴趣的:(瞎折腾,linux,运维,服务器)