apt-get 是用於從身份驗證源檢索包 包信息,安裝 升級 移除包及其依賴的命令行接口。
apt-get update apt-get upgrade apt-get install build-essential
基本語法
apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...]
配置 options 和語法
root:~# find / -name apt.conf /usr/share/doc/apt/examples/apt.conf root:~#
配置源
root:~# find / -name sources.list /etc/apt/sources.backup.d/sources.list /etc/apt/sources.list /usr/share/doc/apt/examples/sources.list root:~#
Command 命令
| 參數 | EN 解釋 | 中文翻譯 | 備注 |
|---|---|---|---|
| update | Retrieve new lists of packages | 檢索新的包列錶 | |
| upgrade | Perform an upgrade | 履行升級 | |
| install | Install new packages (pkg is libc6 not libc6.deb) | 安裝新的包 (pkg 是 libc6,非 libc6.deb) | |
| remove | Remove packages | 移除包 | |
| purge | Remove packages and config files | 移除包和配置文件 | |
| autoremove | Remove automatically all unused packages | 自動移除所有未使用的包 | |
| dist-upgrade | Distribution upgrade, see apt-get(8) | 分發升級,見 apt-get(8) | |
| dselect-upgrade | Follow dselect selections | 遵循 dselect 選定 | |
| build-dep | Configure build-dependencies for source packages | 為源包配置構建依賴 | |
| clean | Erase downloaded archive files | 擦除下載存檔文件 | |
| autoclean | Erase old downloaded archive files | 擦除舊的下載存檔文件 | |
| check | Verify that there are no broken dependencies | 驗證沒有斷開的依賴 | |
| source | Download source archives | 下載源存檔 | |
| download | Download the binary package into the current directory | 把二進製包下載到當前目錄 | |
| changelog | Download and display the changelog for the given package | 下載並顯示給定包的變更日誌 |
| 功能 | 命令 | 文字解釋 | 示例 | 示例解釋 |
|---|---|---|---|---|
| 更新 | apt-get update | 更新係統軟件包列錶 | ||
| apt-get update --fix-missing | 修復更新係統軟件包丟失列錶 | |||
| 升級 | apt-get upgrade | 升級係統軟件包, 但不升級從屬 (桌麵版用戶需登錄, 纔能正常使用遠程控製) | ||
|
apt-mark hold packagename apt-get upgrade |
排除 packagename 升級係統軟件包 (但不升級從屬) | |||
| apt-get -u upgrade | 展示完整可更新軟件包列錶, 升級係統軟件包 (但不升級從屬) | |||
| apt-get dist-upgrade | 升級係統軟件包 (且升級從屬) | |||
| 安裝 | apt-get install packagename | 安裝軟件包 | apt-get install nginx | 安裝 nginx 軟件包 |
| apt-get install --reinstall packagename | 重新安裝軟件包 | apt-get install nginx=1.14.0 | 安裝 nginx 1.14.0 軟件包 | |
| apt-get -f install packagename | 強製修復安裝軟件包 (破損依賴關係),-f = --fix-m | apt-get install build-essential | 安裝構建所需的一切 | |
| 卸載 | apt-get remove packagename | 卸載已安裝軟件包 (但保留配置文檔) | apt-get remove mysql | 卸載 mysql-client 軟件包 (但保留配置文檔) |
| apt-get purge packagename | 卸載已安裝軟件包 (並刪除配置文檔) | apt-get purge mysql-serve | 卸載已安裝 mysql-server 軟件包 (並刪除配置文檔) | |
| apt-get remove --purge packagename | 卸載已安裝軟件包 (並刪除配置文檔) | |||
| 移除 | apt-get autoremove packagename | 刪除包及其依賴軟件包 | ||
| apt-get autoremove --purge packagname | 刪除包及其依賴軟件包 + 配置文件 | |||
| apt-get autoremove | 刪除安裝包時自動安裝的依賴,而現在不需要的依賴包 | |||
| 清理 | apt-get clean | 刪除已安裝軟件的備份 | ||
| apt-get autoclean | 刪除已安裝、已卸載軟件包的備份 | |||
| 下載 | apt-get source packagname | 下載 pkg 包源代碼到當前目錄 | ||
| apt-get source -d packagname | 下載完源碼包後,進行編譯 | |||
| apt-get download packagname | 下載 pkg 包的二進製包到當前目錄 | |||
| 構建 | apt-get build-dep packagname | 構建 pkg 源碼包依賴環境 | ||
| 幫助 | apt-get --help | 展示幫助信息 | ||
| 版本 | apt-get --version | 展示版本信息 |
錯誤: *** 暫時不能解析域名 "***" 的解決辦法
root:~# vi /etc/resolv.conf 在尾部添加 nameserver 8.8.8.8
版權聲明: 本文為獨傢原創稿件,版權歸 樂數軟件 ,未經許可不得轉載。