Ubuntu 安装yum命令 并配置yum源

20220613更新

在Ubuntu使用yum install 安装时候自动升级了系统的一些组件导致系统瘫痪,Ubuntu正确配置和使用yum的方法待更新

文章目录

  • 20220613更新
  • 创建配置目录
  • 创建配置源
  • 生成缓存

直接使用

sudo apt install yum

是可以安装成功,但是这个yum没有配置源,是不能正常安装软件的

创建配置目录

sudo mkdir /etc/yum.repos.d

创建配置源

这里使用的配置版本是CentOS-7.9.2009的源

sudo vi /etc/yum.repos.d/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-7.9.2009 - Base
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/
        https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-7.9.2009 - Updates
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/
		https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/updates/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-7.9.2009 - Extras
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/
        https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/extras/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7.9.2009 - Plus
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/
        https://mirrors.tuna.tsinghua.edu.cn/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-7.9.2009 - 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 makecache

至此配置完成
Ubuntu 安装yum命令 并配置yum源_第1张图片

你可能感兴趣的:(Linux,ubuntu,centos,服务器)