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 update |
apt update |
apt-get update |
刷新存儲庫索引 |
apt upgrade |
apt unpgrade |
apt-get upgrade |
升級全部可升級的軟件包 |
apt dist-upgrade |
apt dist-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 edit-sources |
apt edit-sources |
無 |
編輯源列表 |
軟件倉庫
位置 |
免費/收費 |
維護方 |
main |
免費 |
Ubuntu官方維護 |
universe |
免費 |
第三方維護 |
restricted |
收費 |
第三方維護(通常是盈利性質的商業機構) |
multiverse |
收費 |
第三方維護(通常是非盈利組織或我的) |
- 能夠用命令查看某個 package 屬於 Main,Universe,Restricted 仍是 Multiverse。
apt policy <package>
更新等級
security:重要的安全更新
updates:非安全性更新,即不影響到系統安全的 bug 修補。
proposed:預更新,小 beta 版,事後會進入[updates]或[security]。
backports:新軟件的反向導出,新軟件爲老系統編譯的版本。
軟件源
以 Ubuntu 20.04 爲例
中科大
# 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
阿里雲
- 編輯文件 /etc/apt/sources.list
sudo apt edit-sources
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
本文出自
qbit snap