Ubuntu APT(qbit)

apt 与 apt-get

  • APT: Advanced Packaging Tool
  • apt 命令不是 apt-get 的简写
  • apt 整合了 apt-get、apt-cache 和 apt-config 中的常用命令
  • 可以将 apt 看作 apt-get 的升级版
  • 常用命令对比

    apt 命令 示例 取代的命令 命令的功能
    apt install apt install unzip apt-get install 安装软件包
    apt remove apt remove unzip apt-get remove 移除软件包
    apt purge apt purge unzip apt-get purge 移除软件包及配置文件
    apt depends apt depends python3 apt-cache depends 查看软件包依赖
    apt update apt update apt-get update 刷新存储库索引
    apt upgrade apt upgrade apt-get upgrade 升级所有可升级的软件包
    apt autoremove apt autoremove apt-get autoremove 自动删除不需要的包
    apt full-upgrade apt full-upgrade apt-get dist-upgrade 在升级软件包时自动处理依赖关系
    apt search apt search unzip apt-cache search 在 package descriptions 搜索
    apt show apt show unzip apt-cache show 显示 package 的详细情况
    apt list apt list "*unzip" 根据 package 名字列出 package
    apt list --installed apt list --installed 查看已安装的 package
    apt edit-sources apt edit-sources 编辑源列表

软件仓库

位置 免费/收费 维护方
main 免费 Ubuntu官方维护
universe 免费 社区维护
restricted 收费 第三方维护(一般是品牌厂商)
multiverse 收费 野库
  • 可以用命令查看某个 package 属于 Main,Universe,Restricted 还是 Multiverse。

    apt policy 
  • 也可以在 launchpad 查看

更新等级

  • UbuntuUpdates

    security:重要的安全更新
    updates:非安全性更新,即不影响到系统安全的 bug 修补。
    proposed:预更新,小 beta 版,过后会进入[updates]或[security]。
    backports:新软件的反向导出,新软件为老系统编译的版本。

软件源

以 Ubuntu 20.04 为例

中科大

  • /etc/apt/sources.list 生成器: repository file generator
  • 替换 sources.list 的命令

    # http 源
    wget https://mirrors.ustc.edu.cn/repogen/conf/ubuntu-http-4-focal -O sources.list
    # or https 源
    wget https://mirrors.ustc.edu.cn/repogen/conf/ubuntu-https-4-focal -O sources.list
    sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
    sudo mv sources.list /etc/apt/sources.list
    sudo apt update

阿里云

  • 阿里云 Ubuntu 镜像
  • 编辑文件 /etc/apt/sources.list

    sudo apt edit-sources
  • Ubuntu 20.04 LTS(x86)

    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-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    
    ## Not recommended
    # 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
  • Ubuntu 20.04 LTS(arm)

    deb https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
    
    ## Not recommended
    # deb https://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
    # deb-src https://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
本文出自 qbit snap

你可能感兴趣的:(apt-getubuntu)