RedHat安装yum教程

获取对应CentOS对应版本

cat /etc/redhat-release 
# 输出如下:
# CentOS Linux release 7.9.2009 (Core)
根据输出的CentOS版本如上:7.9.2009,则在阿里云找到对应的包文件。

创建安装目录

mkdir yum
cd yum

下载插件

#必选RPM
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/PackageKit-yum-1.1.10-2.el7.centos.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-rhn-plugin-2.0.1-10.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
#可选RPM,根据安装依赖检测
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/PackageKit-1.1.10-2.el7.centos.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/langtable-python-0.0.31-4.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/langtable-0.0.31-4.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/langtable-data-0.0.31-4.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/PackageKit-glib-1.1.10-2.el7.centos.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/compat-libpackagekit-glib2-16-0.8.9-1.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/libarchive-3.1.2-14.el7_7.x86_64.rpm

 安装插件

rpm -ivh *.rpm --force
如果安装出现依赖错误,去阿里云地址找对应插件就可以, centos-7.9.2009-os-x86_64-Packages安装包下载_开源镜像站-阿里云。 

 导入CentOS-Base.repo

cd /etc/yum.repos.d/
vi Centos-Base.repo

################################
#如下是示例,也可以用默认#
################################
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.9.2009/os/$basearch/
        http://mirrors.aliyuncs.com/centos/7.9.2009/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.9.2009/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/7.9.2009/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.9.2009/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/7.9.2009/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.9.2009/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/7.9.2009/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.9.2009/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/7.9.2009/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 清空并加载缓存

yum clean all
yum makecache
 接下来就可以愉快地使用yum安装插件了!! 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值