当前位置: 首页 > news >正文

linux操作系统 包管理工具 包括国产操作系统

各系统的包管理工具介绍

现阶段多种操作系统、多种不同版本,相继有好几个包管理工具,就RHEL/Centos就有rpm、yum、dnf三种,Ubuntu有dpdk、apt、apt-get等,还有一些跨发行版本,以及通用软件管理方式pip、pip3,除了这些常见的操作系统,国产操作系统又用到了哪些包管理工具呢。

openouler系统是基于RHEL/CentOS生态构建,从openEuler20.03LTS开始版本开始默认使用dnf工具,取代老版本的yum软件管理工具。

银河麒麟kylinos因版本不同,所用的包管理工具也不同,如果是桌面版本的操作系统,大多是基于ubuntu系统开发,因此延用dpdk和apt等工具;如果是服务器版本的操作系统,是基于CentOS/openEuler技术开发,包管理工具使用yum、dnf等

中标麒麟neokylin是早期版本基于CentOS/openEuler开发,随着centos的停更,新版本逐渐转向openouler系统开发,如v7/v10版本,这些都已经默认使用dnf。

那这么多操作系统,不同发现版使用的包管理工具也不同。但是系统都有默认的包管理工具,并且都是linux操作系统,通过命令查看确认使用的是rpm系还是Deb系。

#查询系统版本的路径基本都差不多 ls /etc/*release #看看有哪些文件,基本都显示系统版本,os-release显示的更详细 cat /etc/os-release #ID="kylin" + VERSION_ID="V10" + UBUNTU_CODENAME=... → 是 Ubuntu 基础 → 用 apt #ID="kylin" + VERSION_ID="V10" + PLATFORM_ID="platform:el8" 或类似 RHEL 字样 → 是 RPM 基础 → 用 yum/dnf #或者查询默认有没有api或者rpm判断 which apt && echo "使用 apt (Deb系)" || echo "可能不是 Deb 系" which rpm && echo "使用 rpm (RPM系)" || echo "可能不是 RPM 系"

按照这中方式确定系统是用那中包管理工具。

Ubuntu/Dabian Deb系

sudo apt update sudo apt install nginx sudo dpkg -i package.deb #不推荐,不自动解决依赖。

RHEL/CentOS RPM系

# CentOS 7 sudo yum install httpd # CentOS 8+/Rocky Linux sudo dnf install httpd # 直接安装 RPM(不推荐,除非你知道依赖已满足) sudo rpm -ivh package.rpm

国产信创系统就看是基于哪种操作系统研发的,一般常规也就分deb系和rpm系。

python pip

除了上述操作系统默认的包管理工具以外,还有各种通用的软件管理工具,也可以在linux系统中使用。这里介绍python脚本语言常用的模块安装工具pip/pip3,新版的ansible服务也可以通过pip3安装。

包管理工具的基本使用

RHEL/CentOS RPM系

常用yum和dnf,yum和dnf的使用基本一致,常用的yum方式和dnf没区别。dnf可从epel源中安装。rpm工具无法解析依赖,不常用。

dnf安装依赖包比yum解析依赖更快、更精准,支持多版本和模块化管理。

全局配置文件/etc/yum.conf在dnf中仍然适用,.repo文件无需修改。

dnf默认是/etc/dnf/dnf.conf。

Deb系Linux发行版

Deb系Linux发行版(如Debian、Ubuntu、Linux Mint、Kylin桌面版 等)中,软件包以.deb 格式分发,主要使用两类包管理工具,dbk和apt-get ,dbkg不解决依赖关系,apt是apt-get的简化版本,能够解析.deb包的依赖关系并完成安装。

全局配置文件:/etc/apt/apt.conf,一般没有这个文件,常规配置是在/etc/apt.conf.d/目录下。通过apt-config dump可查看当前配置参数。

软件源列表配置文件:/etc/apt/sources.list

扩展源列表文件:/etc/apt/sources.list.d/

配置国内软件源

配置yum软件源

目前国产化替代的浪潮中,建议国内软件源加速器使用华为,华为在推进国产化替代中,有着无可替代的作用和决心,是完全可以信赖的公司。当前目前支持最好的还是阿里云,后续配置推荐阿里云软件源。

仓库文件目录: /etc/yum.repo.d/

mkdir -p /etc/yum.repos.d.bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d.bak/ #华为云软件源 https://mirrors.huaweicloud.com/home #阿里云软件源 https://developer.aliyun.com/mirror #centos7 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum clean all && yum makecache #centos8 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo yum clean all && yum makecache

也可以自动切换当前默认的配置为国内软件源

codename=$(lsb_release -cs) sudo sed -i "s|http://[a-z0-9\.]*\.archive\.ubuntu\.com|https://mirrors.aliyun.com|g" /etc/apt/sources.list sudo apt update

清理并重新加载缓存

dnf clean all #或者yum clean all dnf makecache #或者yum makecache

验证

yum repolist dnf repolist

配置apt软件源

仓库文件目录:/etc/apt/sources.list,配置国内apt软件源,用阿里云。

#先备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #编辑/etc/sources.list sudo tee /etc/apt/sources.list <<'EOF' deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse EOF #更新软件源 sudo apt update #验证测试 apt policy

其他操作系统对应软件源可从阿里云官网查看:

ubuntu国内软件源列表

ubuntu每年都跟新一个稳定版,不同版本的软件源路径如下,

Ubuntu 18.04版本

deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Ubuntu 20.04版本

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

Ubuntu 22.04版本

deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

最新系统Ubuntu 2404

deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse # deb https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse

往期推荐:来自于个人公众号发布路途-在路上博客

部署局域网内部yum服务器

局域网内部配置ubuntu apt本地软件源

http://www.cnnetsun.cn/news/65036.html

相关文章:

  • apk pure安全性争议下,本地大模型成新趋势
  • LobeChat能否支持NFT头像展示?个性化形象设定
  • LobeChat + Kubernetes:大规模部署AI前端界面的可行路径
  • 20万以内家用新能源SUV怎么选?纯电动车型主动安全系统深度对比
  • 基于28DR+VU13P的宽带高速信号处理板
  • AutoGPT镜像上线促销:限时赠送免费Token额度
  • 达人内容乱+不合规?KOL/KOS/KOC/KOC/KOX内容协同+合规管控,品牌调性不跑偏
  • 解锁优质创意素材:这四个专业平台值得收藏
  • 毕设分享 深度学习遮挡下的人脸识别(源码+论文)
  • Python UV搭配Miniconda:下一代包管理体验
  • 实验室装修,怎样做更省心?
  • Redis多数据源配置指南
  • AutoGPT支持ONNX Runtime部署了吗?跨框架兼容测试
  • 零基础小白网络安全入行清单:学技术前,先搞定这6件“小事”
  • 计算机毕业设计springboot小区送货系统 基于SpringBoot的社区末端智能配送平台 面向住宅区的 轻量级电商物流管理系统
  • GitHub组织账号管理Qwen3-32B项目协作开发流程
  • 毕设项目分享 基于大数据的招聘职业爬取与分析可视化
  • vLLM镜像实测:连续批处理让Qwen推理效率翻倍
  • LabVIEW 携手 YOLOv8:全方位视觉处理的奇妙之旅
  • 某雷赛86闭环步进驱动方案-HBS86H整体方案及原理图、PCB、无错无警告代码打包
  • 【从0到1学RabbitMQ】十分钟上手 RabbitMQ:Docker 部署 + Spring Boot 自动化配置全攻略
  • 【论文笔记•(多智能体)】A Knowledge-driven Adaptive Collaboration of LLMs for Enhancing Medical Decision-making
  • 通过SEO推广LobeChat博客内容,带动大模型Token购买转化
  • 【Svelte】重定向页面
  • 基于SpringBoot的日用品仓储管理系统的设计与实现
  • 基于SpringBoot的校园论坛交流系统
  • AutoGPT如何处理模糊目标?自然语言理解边界探讨
  • 清华镜像站推荐:Miniconda下载提速80%的秘密武器
  • update.py update脚本 git一键上传push脚本 - Git自动化推送代码的几种方式及实用脚本
  • 从GitHub获取Qwen3-8B最新镜像并完成本地化部署