Nov 17, 2010

ubuntu aptitude, apt-get, deb

照我的理解,aptitude 是apt的文字界面,apt-get是apt使用的一个程序
因此aptitude可以分辨package是否安装,以及处理依赖关系
推荐使用aptitude

sudo aptitude install packagename
sudo aptitude remove packagename
sudo aptitude update
sudo aptitude upgrade 
sudo aptitide search

Each search result is listed on a separate line. The first
character of each line indicates the current state of the package:
the most common states are p, meaning that no trace of the package
exists on the system, c, meaning that the package was deleted but
its configuration files remain on the system, i, meaning that the
package is installed, and v, meaning that the package is virtual.
The second character indicates the stored action (if any; otherwise
a blank space is displayed) to be performed on the package, with
the most common actions being i, meaning that the package will be
installed, d, meaning that the package will be deleted, and p,
meaning that the package and its configuration files will be
removed. If the third character is A, the package was automatically
installed.

清理 cache
sudo aptitude clean
或者 sudo apt-get clean


deb 包
  • Install a downloaded Debian (Ubuntu) package (.deb):
sudo dpkg -i packagename.deb
  • Remove a Debian (Ubuntu) package (.deb):
sudo dpkg -r packagename
  • Reconfigure/Repair an installed Debian (Ubuntu) package (.deb):
sudo dpkg-reconfigure packagename 

apt-get
  • Install packages:
sudo apt-get install packagename
  • Example:
sudo apt-get install mpd sbackup
  • Remove packages:
sudo apt-get remove packagename
  • To remove all dependencies:
sudo apt-get autoremove
  • Example:
sudo apt-get remove mpd sbackup
  • Search for packages:
apt-cache search 
  • Examples:
apt-cache search Music MP3
apt-cache search "Text Editor"
sudo apt-get update
  • Upgrade packages:
sudo apt-get upgrade
  • Upgrade the entire distribution (e.g. from Lucid to Maverick):
sudo apt-get dist-upgrade

0 comments: