Ubuntu默认使用APT包管理器,若需添加类似YUM的源,实际是配置APT源,步骤如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo nano /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb 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
jammy替换为你的Ubuntu版本代号,可通过lsb_release -a查看)sudo apt update
注意:Ubuntu不支持YUM源,上述操作是配置APT源。若需使用YUM,需安装yum或dnf工具(非官方支持,可能引发依赖问题)。