# ubuntu 系统使用 yum命令报错 There are no enabled repos.Run “yum repolist all“ to see the repos you have...

ubuntu 系统使用 yum命令报错 There are no enabled repos.Run “yum repolist all” to see the repos you have.You can enable repos with yum-config-manager --enable

一、错误描述:

在这里插入图片描述

二、解决方案

1、一般来说著名的 linux 系统基本上分两大类

1 RedHat 系列:Redhat、Centos、Fedora等
2 Debian系列:Debian、Ubuntu等

1.1 RedHat 系列:Redhat、Centos、Fedora 系统等。
  • 1) 常见的安装包格式 rpm 包,安装 rpm 包的命令是 “rpm -参数’。
  • 2) 包管理工具 yum。
  • 3) 支持 tar 包。
1.2 Debian 系列:如 Debian、Ubuntu 等系统。
  • 1、 常见的安装包格式 deb 包,安装 deb 包的命令是 “dpkg -参数"。
  • 2 、包管理工具 apt 或 apt-get。
  • 3 、支持 tar 包。
    所以可以使用 apt 或者 apt-get 命令,代替 yum 命令。

2、在 ubuntu 系统上安装 yum

2.1 安装 build-essential 软件包集合工具。
sudo apt-get install build-essential
或者
apt-get install build-essential
2.2 安装 yum
sudo apt-get install yum
或者
apt-get install yum
2.3 配置 yum 源

Ubuntu 没有 yum 源,所以要想使用 yum 安装软件必须要配置 yum 安装源。在 /etc/yum/repos.d/ 目录下创建两个文件,fedora-163.repo 和 fedora-updates-163.repo。分别复制以下配置信息保存即可。

# 如果 yum 安装成功,可查看版本
yum --version

# 查看系统中的软件仓库列表,也许为 0,因为你没有配置 yum 安装源
yum repolist all

在这里插入图片描述

1)如果没有 /etc/yum/repos.d/ 目录,先创建此目录。

# 创建目录
mkdir  /etc/yum/repos.d/ 

2)创建 fedora-163.repo 文件。vim /etc/yum/repos.d/fedora-163.repo

[fedora]
 
name=Fedora 17 - $basearch - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-17&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
 
[fedora-debuginfo]
name=Fedora 17 - $basearch - Debug - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/releases/17/Everything/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-17&arch=$basearch
enabled=0
metadata_expire=7d 
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
 
[fedora-source]
name=Fedora 17 - Source - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/releases/17/Everything/source/SRPMS/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-17&arch=$basearch
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

3)创建 fedora-updates-163.repo 文件。vim /etc/yum/repos.d/fedora-updates-163.repo

[updates]
name=Fedora 17 - $basearch - Updates - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/updates/17/$basearch/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f17&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
 
[updates-debuginfo]
name=Fedora 17 - $basearch - Updates - Debug - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/updates/17/$basearch/debug/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f17&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
 
[updates-source]
name=Fedora 17 - Updates Source - 163.com
failovermethod=priority
baseurl=http://mirrors.163.com/fedora/updates/17/SRPMS/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f17&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

4)在终端输入执行配置,配置完成,可以使用 yum 源了进行安装了。

yum makecache

3、如果 Yum 的镜像站点速度较慢,你可以尝试切换到其他镜像站点。在 Yum 的配置文件中,你可以设置baseurl来指定镜像站点的地址。

# 备份当前 yum 源,如:
sudo mv /etc/yum/repos.d/CentOS-Base.repo /etc/yum/repos.d/CentOS-Base.repo.backup

# 下载 yum 源,如:

# 下载新的YUM源配置文件。这取决于你想要更换的源,例如阿里云源,可以使用以下命令,也可以 使用 wget 命令。
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 阿里-centos7:
http://mirrors.aliyun.com/repo/Centos-7.repo

# 网易-centos7:
http://mirrors.163.com/.help/CentOS7-Base-163.repo

# 清除YUM缓存并生成新的缓存
sudo yum clean all
sudo yum makecache

# 更新系统
sudo yum update

4、Ubuntu 系统,还是强烈建议使用 包管理工具 apt 或 apt-get ,因为 Ubuntu 系统 使用 yum 兼容性较差,及其不稳定,也许会有意想不到的问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

段子手-168

你的鼓励将是我你的创作最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值