2009-12-01
| Revision History | ||
|---|---|---|
| Revision 0.1 | 2005-02-01 | djchou |
| first draft, Debian好用指令 | ||
| Revision 0.2 | 2009-12-01 | djchou |
| Remove cscope | ||
Abstract
Hi all, here is a note for apt command. I hope that will be helpful to everybody.
Table of Contents
APT is the kernel of debian linux distribution. It is useful and once you can surf on net,
you can download (almost) all the free software you want. The best of APT is that you no
longer need to worry about the dependencies of software packages. It makes your life better
in Linux.
Debian的套件以dpkg為核心, 此外,
其管理機制交由apt來管理, 除此之外, 還有
許多前端的程式例如aptitude或dselect幫助我們使用;
使用apt之前我們要先指定來源,
因此我們要編輯系統中的/etc/apt/sources.list檔案.
以下是我的sources.list
deb http://debian.linux.org.tw/debian sarge main non-free contrib
deb-src http://debian.linux.org.tw/debian sarge main non-free contrib
deb http://debian.linux.org.tw/debian-non-US sarge/non-US main non-free contrib
deb-src http://debian.linux.org.tw/debian-non-US sarge/non-US main non-free contrib
deb http://security.debian.org/ stable/updates main contrib non-free
在這裡就先不提sarge, main, non-free, contrib的意義了, 有興趣的人可以去看
debian無痛起步, 裡面有詳細的說明
Note
如果你不知道sources.list檔案要怎麼生出來的話,
可以使用apt-setup來加入來源
以下是一些apt當中常用的指令
apt-get update - 更新資料庫
apt-get upgrade - 更新整個系統
apt-get install pkg-name - 安裝pkg-name這個套件
apt-get remove pkg-name - 移除pkg-name這個套件
apt-get source pkg-name - 安裝pkg-name這個套件的原始檔
apt-get clean - 清除下載的套件
apt-get autoclean - 清除不需要的下載套件
apt-cache search pkg - 搜尋有pkg這個關鍵字的套件
apt-cache show pkg-name - 顯示pkg-name這個套件的相關資訊
dpkg是系統套件的核心, 其套件檔案的結尾通常是.deb, 以下是一些dpkg程式常用指令
dpkg -i pkg-file - 安裝pkg-file這個套件檔案
dpkg -i --force-all pkg-file - 強制安裝pkg-file這個套件檔案
dpkg -r pkg-name - 移除pkg-name
dpkg -r --purge --force-depends pkg-name - 移除pkg-name以及設定檔
dpkg -l - 列出系統中所有package
dpkg -l pkg-names - 和dpkg -l相同, 不過僅列出和pkg-name符合的項目
dpkg -L pkg-names - 列出pkg-name這個package當中
dpkg -S file-name - 列出包含file-name這個檔案的套件名稱
dpkg --get-selections - 列出安裝的檔案
dpkg-reconfigure pkg-name - 重新設定pkg-name
沒有留言:
張貼留言