我是武男, 24歲, 大家都叫我阿男...有的人還會叫我白目老百姓...找我的話請Google "武男" 就沒錯了~

uBuntu Zone- 安裝套件的好工具』apt-get』

Autor 白目研究生

參考資料:http://apt.nc.hcc.edu.tw/web/apt/apt.html

APT(Advanced Package Tool)用來快速安裝套件的好工具

選用 APT 最大的理由是:它能夠自動處理 RPM 相依性的問題

更新來源

# apt-get update

安裝套件

# apt-get install 『one or more packet_name』

下面以使用install ee Example

# ee ldap.conf
The program ‘ee’ is currently not installed.  You can install it by typing:
apt-get install ee
-su: ee: command not found
# apt-get install ee
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
  ee
0 upgraded, 1 newly installed, 0 to remove and 21 not upgraded.
Need to get 45.3kB of archives.
After unpacking 152kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com gutsy/universe ee 1:1.4.2-7 [45.3kB]
Fetched 45.3kB in 2s (19.3kB/s)
Selecting previously deselected package ee.
(Reading database … 15456 files and directories currently installed.)
Unpacking ee (from …/ee_1%3a1.4.2-7_i386.deb) …
Setting up ee (1:1.4.2-7) …

然後就…裝完了…

如果要安裝已經知道名稱但是不知道全名的話也可以透過下面方式搜尋

# apt-cache search 『keyword』

安裝完的套件一定要有檢視目前安裝的套件清單的功能

那就…

# dpkg –list    //嘖,wordpress吃字,這裡是兩個減號,減減list

這樣子就可以了

當使用 apt-get install 指令安裝套件,下載下來的 rpm 會放置於 /var/cache/apt/archives,使用 apt-get clean 指令可以將之清除,避免佔用硬碟空間

# apt-get clean

假如我們想要移除某個 rpm 的時候就可以使用此指令,例如:apt-get remove httpd,就會移除 httpd 了,假如這個 rpm 有相依性套件的時候,apt 也會一併移除

# apt-get remove 『keyword』

至於維護apt source的話,請參考/etc/apt/sources.list

# cat /etc/apt/sources.list

可以觀察到來源主要以http://tw.archive.ubuntu.com/ubuntu/為主

另外看一下以光碟媒介的來源(以uBuntu Server 7.10為例)

deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted

我通常會註解掉,以網路上持續維護的來源為主

如果你有需要安裝套件,卻出現下面提示訊息的話,依照上面註解掉光碟媒介來源,就不會有這個問題了

Media change: please insert the disc labeled
 ’Ubuntu-Server 7.10 _Gutsy Gibbon_ – Release i386 (20071016)’
in the drive ‘/cdrom/’ and press enter

以上

Random Posts

請留言

CommentComment