0
点赞
收藏
分享

微信扫一扫

解释 dpdk\apt\apt-get\snap 的区别

颜路在路上 2023-09-06 阅读 73

Author xxxxxx@163.com

Date Sep. 06, 2023

Description 本文解释 dpdk\apt\apt-get\snap 的区别

环境

虽然我是用的是lubuntu22.04,但仍然属于Ubuntu不是。

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

APT

APT (Advanced Package Tool),是一系列的Debian系Linux系统管理软件安装、卸载、更新的工具集的总称。apt、apt-get、apt-cache等是高级命令,用于管理软件的生命周期(姑且这么说吧)。

根据Publishing history : apt package : Ubuntu,apt出现的很早,不过apt 1.0版本是伴随着Ubuntu 14.04发布的,而Ubuntu 16.04才正式将apt用于替换apt-get,当然这些都是历史了,知道不知道没意思。

总之,最重要的是apt简化了apt-get、apt-cache等命令,并添加了安装软件时的进度条以及命令行的颜色提示。 image.png

image.png

另一个区别是:apt-get不能自己安装新的软件,而apt可以安装新的软件。比如在更新linux kernel的时候,apt可以做到而apt-get做不到,因为更新linux kernel实际上就是在安装新的linux kernel。但是apt-get也不是不能安装了,而是需要使用apt-get dist-upgrade才行。

apt 命令 被替代命令 说明
apt install apt-get install 安装软件
apt remove apt-get remove 移除软件
apt update apt-get update 更新repository索引
apt upgrade apt-get upgrade 更新所有可更新的软件
apt autoremove apt-get autoremove 移除不要的软件
apt full-upgrade apt-get dist-upgrade 更新,但自己处理依赖
apt search apt-cache search 查找软件
apt show apt-cache show 展示软件详细信息
apt list 无,新增命令 列出软件,可附带条件
apt edit-sources 无,新增命令 修改/etc/apt/sources.list,不过需要权限

但是apt也不是简单的对于apt-get等命令的简单替换,apt-get没有被完全取代。发现这个其实是因为遇到了一个问题,就是使用aptapt-get安装软件会发生不一样的情况。这也是复写本文的缘由,不过我的观念就是能解决问题就行。

picture 0

以下,最重要的是看下最后的These includes吧。

basil@lubuntu22:~
$ apt show apt
Package: apt
Version: 2.4.10
Priority: important
Build-Essential: yes
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: APT Development Team <deity@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 4,256 kB
Provides: apt-transport-https (= 2.4.10)
Depends: adduser, gpgv | gpgv2 | gpgv1, libapt-pkg6.0 (>= 2.4.10), ubuntu-keyring, libc6 (>= 2.34), libgcc-s1 (>= 3.3.1), libgnutls30 (>= 3.7.0), libseccomp2 (>= 2.4.2), libstdc++6 (>= 11), libsystemd0
Recommends: ca-certificates
Suggests: apt-doc, aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), gnupg | gnupg2 | gnupg1, powermgmt-base
Breaks: apt-transport-https (<< 1.5~alpha4~), apt-utils (<< 1.3~exp2~), aptitude (<< 0.8.10)
Replaces: apt-transport-https (<< 1.5~alpha4~), apt-utils (<< 1.3~exp2~)
Task: minimal, server-minimal
Download-Size: 1,379 kB
APT-Sources: https://mirrors.ustc.edu.cn/ubuntu jammy-updates/main amd64 Packages
Description: commandline package manager
 This package provides commandline tools for searching and
 managing as well as querying information about packages
 as a low-level access to all features of the libapt-pkg library.
 .
 These include:
  * apt-get for retrieval of packages and information about them
    from authenticated sources and for installation, upgrade and
    removal of packages together with their dependencies
  * apt-cache for querying available information about installed
    as well as installable packages
  * apt-cdrom to use removable media as a source for packages
  * apt-config as an interface to the configuration settings
  * apt-key as an interface to manage authentication keys

添加新的apt repos,首先安装software-properties-common,其中包含了add-apt-repository命令。例如:

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:linuxuprising/java

dpkg

Debian系的包是.deb结尾,dpkg可以用于安装、卸载、展示.deb包。不过这是一个低级的命令,例如它就不能解决依赖关系问题。dpkg不能解决依赖问题,不能下载外部包。apt安装本地包就是用的dpkg。dpkg -i <xxx.deb>用于安装,dpkg -r <xxx>用于卸载。

dpkg和rpm命令的相关关系可以查看RPM & APT。

snap

snap和apt都可以用来管理软件包。snap包的好处就是独立于Linux发行版,不管是Debian系,还是Redhat系,还是其他,都可以用。

简单理解就是apt使用的是shared library,所有软件共享相同的依赖;而snap的方式则类似static library,每个软件已经包含了其依赖。所以snap包比较安全,起码没有依赖冲突(这个可以这样理解,比如更换OpenSSL版本,一些新的软件需要新版本,一些老软件还需要老版本,这时候就发生了冲突),因为它运行在sandbox中。

虽然现在Ubuntu也基本要放弃deb包转向snap包了,但个人不太喜欢snap,因为snap的包体积大且软件运行慢,这个在Ubuntu 22.04。本人不属于任何流派,然而接触最多的确实是Ubuntu,所以后续也就继续抱着啃老本吧,真是老顽固。

参考

  1. Difference Between APT and DPKG in Ubuntu - GeeksforGeeks
  2. What is the difference between apt and apt-get? - Ask Ubuntu
  3. APT 1.0 Is Out After 16 Years, Gets Simplified Commands and Color Output
  4. Introduction to snaps | Ubuntu
举报

相关推荐

0 条评论