解决阿里云远程连接yum无法安装问题(Ubuntu 22.04)

解决阿里云远程连接yum无法安装问题(Ubuntu 22.04)

第一步 进入阿里云远程连接后,尝试安装宝塔面包

使用下列命令安装宝塔面板(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

第四步:尝试更换清华镜像源

  1. 先备份:

    复制代码
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  2. 打开文件:使用如下命令打开文件

    复制代码
    sudo vim /etc/apt/sources.list
  3. 将原有的内容全部删除,替换成如下内容

    复制代码
    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

随即出现如下提示便是成功了,然后使用其提供的外网面板地址和账号密码登陆即可

相关推荐
虚拟指尖5 小时前
Ubuntu编译安装COLMAP【实测编译成功】
linux·运维·ubuntu
周之鸥9 小时前
从零部署 Astro 静态网站到云服务器(含 HTTPS 一键配置)
运维·服务器·ubuntu·http·https·astro
阿里-于怀12 小时前
阿里云发布《AI 原生应用架构白皮书》
人工智能·阿里云·ai·架构·白皮书·ai原生
九河云12 小时前
如何选择适合的加密方法来保护云计算中的数据
网络·科技·物联网·金融·云计算
中草药z12 小时前
【Docker】零基础上手:原理+Ubuntu/Windows GUI 安装 + 镜像源 / 目录优化
运维·ubuntu·docker·容器·gui·安装·cgroups
Tfly__15 小时前
Ubuntu 20.04 安装Aerial Gym Simulator - 基于 Gym 的无人机强化学习仿真器
linux·人工智能·ubuntu·github·无人机·强化学习·运动规划
博睿谷IT99_15 小时前
Linux 云计算核心技术:原理、组件与 K8s 实战部署
linux·kubernetes·云计算
我总是词不达意16 小时前
vue3 + el-upload组件集成阿里云视频点播从本地上传至点播存储
前端·vue.js·阿里云·elementui
qq_3391911419 小时前
aws docker安装,ec2安装docker-compose
docker·云计算·aws
等风来不如迎风去19 小时前
用你本地已有的私钥(private key)去 SSH 登录远程 Ubuntu 服务器
服务器·ubuntu·ssh