解决阿里云远程连接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
    
  1. 打开文件:使用如下命令打开文件

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

    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

随即出现如下提示便是成功了,然后使用其提供的外网面板地址和账号密码登陆即可
截屏2023-12-27 11.14.50.png

相关文章
|
4月前
|
Ubuntu JavaScript 关系型数据库
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
在阿里云Ubuntu 20.04服务器上部署Ghost博客的步骤包括创建新用户、安装Nginx、MySQL和Node.js 18.x。首先,通过`adduser`命令创建非root用户,然后安装Nginx和MySQL。接着,设置Node.js环境,下载Nodesource GPG密钥并安装Node.js 18.x。之后,使用`npm`安装Ghost-CLI,创建Ghost安装目录并进行安装。配置过程中需提供博客URL、数据库连接信息等。最后,测试访问前台首页和后台管理页面。确保DNS设置正确,并根据提示完成Ghost博客的配置。
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
|
4月前
|
Ubuntu 网络协议 网络安全
如何在外SSH远程连接Ubuntu系统【无公网IP】
如何在外SSH远程连接Ubuntu系统【无公网IP】
138 0
|
1月前
|
Web App开发 缓存 Ubuntu
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
121 11
|
4月前
|
弹性计算 Ubuntu Linux
【阿里云】阿里云ECS云服务器幻兽帕鲁游戏优化及存档导出导入(Ubuntu)
【阿里云】阿里云ECS云服务器幻兽帕鲁游戏优化及存档导出导入(Ubuntu)
1551 4
|
3月前
|
弹性计算 Ubuntu Linux
Ubuntu 镜像-阿里云
Ubuntu 镜像-阿里云
165 1
|
3月前
|
Ubuntu Python
银河麒麟-麒麟软件操作系统 kylin 搭建yum源 ubuntu搭建yum源 yum软件仓库搭建ftp源、python源、硬盘源
银河麒麟-麒麟软件操作系统 kylin 搭建yum源 ubuntu搭建yum源 yum软件仓库搭建ftp源、python源、硬盘源
406 1
|
3月前
|
缓存 Linux
CentOS7添加阿里云yum源
CentOS7添加阿里云yum源
3592 1
|
4月前
|
存储 弹性计算 NoSQL
阿里云Ubuntu20.04安装MongDB
本文主要演示如何使用阿里云Ubuntu20.04,并使用阿里云DMS工具登录MongDB。
200 0
阿里云Ubuntu20.04安装MongDB
|
4月前
【阿里云】基于Ubuntu22.04搭建PalWorld代码
【阿里云】基于Ubuntu22.04搭建PalWorld代码
253 2
|
4月前
|
Ubuntu 网络协议 Linux
【Linux】Android平板上远程连接Ubuntu服务器code-server进行代码开发
【Linux】Android平板上远程连接Ubuntu服务器code-server进行代码开发
122 0