解决阿里云远程连接yum无法安装问题(Ubuntu 22.04)
- 第一步 进入阿里云远程连接后,尝试安装宝塔面包
- 第二步:尝试更新软件包等一些列操作
- 第三步:完成上述操作之后,尝试安装yum
- 第四步:尝试更换清华镜像源
- 第五步:添加公钥并再次尝试安装yum
- 第六步:解决上述python问题
- 第七步:再一次安装宝塔面板
第一步 进入阿里云远程连接后,尝试安装宝塔面包
使用下列命令安装宝塔面板(Ubuntu版本)
wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec
随即出现yum没有安装的错误
Command 'yum' not found, did you mean:
command 'gum' from snap gum (0.13.0)
command 'num' from deb quickcal (2.4-1)
command 'sum' from deb coreutils (8.32-4.1ubuntu1)
command 'zum' from deb perforate (1.2-5.1)
command 'uum' from deb freewnn-jserver (1.1.1~a021+cvs20130302-7build1)
command 'yum4' from deb nextgen-yum4 (4.5.2-6)
See 'snap info <snapname>' for additional versions.
第二步:尝试更新软件包等一些列操作
apt-get install build-essential
出现如下结果
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9ubuntu3).
build-essential set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
第三步:完成上述操作之后,尝试安装yum
使用如下命令安装yum
apt-get install yum
然后出现找不到程序包yum错误
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package yum
第四步:尝试更换清华镜像源
-
先备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
-
打开文件:使用如下命令打开文件
sudo vim /etc/apt/sources.list
-
将原有的内容全部删除,替换成如下内容
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
注:因为使用的是vim打开,下列提供一些简便快捷键操作
- 连续按两次d可删除整行
- 按Esc退出编辑模式,然后按shift+:
- 输入wq保存文件退出
第五步:添加公钥并再次尝试安装yum
更新软件包
sudo apt update
执行上面命令后出现,如下错误,大意为公钥不可用,无法验证以下签名
The following signatures couldn’t be verified because the public key is not available:NO_PUBLIC 40976EAF437D05B5 NO_PUBLIC 3B4FE6ACC0B21F32
执行下面命令添加公钥(由上述错误提示给出)提示给出缺少2个公钥,故要添加俩个公钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
再一次更新软件包
sudo apt update
输入如下命令在此尝试安装yum
sudo apt-get install yum
输入安装yum命令之后,出现python版本问题
The following packages have unmet dependencies:
python3-six : Breaks: libpython-stdlib (< 2.7.18) but 2.7.5-5ubuntu3 is to be installed
Breaks: python-minimal (< 2.7.18) but 2.7.5-5ubuntu3 is to be installed
python3-yaml : Breaks: libpython-stdlib (< 2.7.18) but 2.7.5-5ubuntu3 is to be installed
Breaks: python-minimal (< 2.7.18) but 2.7.5-5ubuntu3 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
第六步:解决上述python问题
尝试安装python-minimal和libpython-stdlib软件包
sudo apt-get install python-minimal libpython-stdlib
然后重新尝试安装yum,执行下列一步,我的yum就安装成功了
sudo apt-get install yum
然后验证是否安装成功
sudo yum version
出现如下则代表安装成功
Installed: $releasever/x86_64 0:da39a3ee5e6b4b0d3255bfef95601890afd80709
version
第七步:再一次安装宝塔面板
然后使用如下脚本安装宝塔面板即可,耐心等待几分钟即可
wget -O install.sh https://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec
随即出现如下提示便是成功了,然后使用其提供的外网面板地址和账号密码登陆即可