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源进行备份,以免翻车。

  1. 备份sources.list文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

  1. 打开sources.list文件

sudo gedit /etc/apt/sources.list

  1. 删除原内容,添加下列内容

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

  1. 保存

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

  1. sudo apt-get update
  2. sudo apt install yum

这样就安装完成了!
Ubuntu下顺利安装yum_第1张图片

你可能感兴趣的:(问题解决,ubuntu)