Ubuntu下安装yum

直接输入yum会报错

Command ‘yum’ not found, but can be installed with:
sudo apt install yum

然后按照提示输入sudo apt install yum, 又会报错

正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
E: 无法定位软件包 yum

显示无法定位软件包
查找原因是因为没有更新包
输入sudo apt-get update,进行更新。又会报错

E: 无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用)
E: 无法对目录 /var/lib/apt/lists/ 加锁

既然加了锁,那就把锁给删了。

sudo rm /var/lib/apt/lists/lock

然后就可以sudo apt-get update。
虽然可以正常更新, 你以为这就解决问题了?
其实你会发现这下载更新速度就像没开百度网盘超级会员的你一样,下载速度特别慢,甚至直接丢包了。
所以我们在sudo apt-get update之前,给apt-get换一个源。
先给之前的apt-get源进行备份,以免翻车。

备份sources.list文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

打开sources.list文件
sudo gedit /etc/apt/sources.list

删除原内容,添加下列内容
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

保存
做完以上前期工作,就要正式安装yum了

sudo apt-get update
sudo apt install yum
这样就安装完成了!

————————————————
版权声明:本文为CSDN博主「小白白上白」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/hua_you_qiang/article/details/108866334

上一篇:如何搭建完整的docker版ubuntu


下一篇:ubuntu18.0 换国内源