在linux系统中直接 apt-get intstall yum
,会报错
weweaq@ubuntu:~$ sudo apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
weweaq@ubuntu:~$ sudo apt-get install yum
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package yum
直接安装没有用,看博客是需要换源
Ubuntu 安装使用yum-阿里云开发者社区 (aliyun.com)
清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
复制这个
ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
# 先安装一手vim
sudo apt-get install vim
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo vim /etc/apt/sources.list
(1)将文件里面的内容全部删除,将上面我们查找的镜像软件源粘贴进去!!切记:尽量的将格式也粘贴的和上面的一样,不会出错!!
(2)再将下面的命令(软件镜像源),也粘贴到上面文件的第一行!
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install yum
发现报错,说缺少这几个包
于是,安装所需依赖即可
sudo apt-get install python-sqlitecachec python-urlgrabber python-pycurl python2
最后再尝试一下
sudo apt-get install yum
安装成功,看看版本