Alibaba Cloud Linux 3.2104 64位 安装软件?

在 Alibaba Cloud Linux 3.2104(基于 CentOS/RHEL 8/9 体系)上安装软件,主要使用 dnf 或 yum 包管理器。以下是详细指南:


✅ 一、基本命令

1. 搜索软件

dnf search <软件名>
# 例如:
dnf search nginx

2. 安装软件

sudo dnf install <软件包名>
# 例如:
sudo dnf install nginx

3. 更新软件

sudo dnf update

4. 卸载软件

sudo dnf remove <软件包名>

5. 查看已安装的软件

dnf list installed

✅ 二、常见操作示例

安装 Nginx

sudo dnf install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx

安装 Python 3

sudo dnf install python3 -y
python3 --version

安装 Git

sudo dnf install git -y
git --version

安装 Docker(需先启用仓库)

# 添加 Docker CE 仓库
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# 安装 Docker
sudo dnf install docker-ce docker-ce-cli containerd.io -y

# 启动并设置开机自启
sudo systemctl start docker
sudo systemctl enable docker

✅ 三、注意事项

  1. 权限问题:大多数安装命令需要 sudo 权限。
  2. 依赖解决:dnf 会自动处理依赖关系,通常无需手动干预。
  3. EPEL 仓库:某些软件不在默认仓库中,可安装 EPEL 扩展包:
    sudo dnf install epel-release -y
  4. 阿里云镜像源:Alibaba Cloud Linux 默认使用阿里云镜像源,速度较快,无需额外配置。
  5. 内核模块与驱动:如需安装特定内核模块或驱动,请确保系统版本匹配,并使用 kmod 相关包。

✅ 四、高级技巧

  • 只下载不安装:

    sudo dnf download <软件包名>
  • 清理缓存:

    sudo dnf clean all
  • 查看软件详情:

    dnf info <软件包名>

如有具体软件名称,可提供更多信息,我可以给出更精确的安装步骤。