歡迎您光臨本站 註冊首頁

關於ubuntu軟體包安裝模式

←手機掃碼閱讀     火星人 @ 2014-03-26 , reply:0

Debian(debian前生,Ubuntu來世) 的軟體分發模式就是 apt-get。所有可用軟體列表信息存放在互聯網的一些地方,一般稱作 源(repositories)。

在終端

sudo gedit /etc/apt/sources.list

就可以看到類似

deb [web address] [distribution name][maincontribnon-free]

這樣的內容。比如

deb http://in.archive.ubuntu.com/ubuntu breezy main restrcted

你可以從社區得到一些更好的源地址。每次修改源地址之後,終端執行

apt-get update

刷新本地的可安裝軟體列表數據。用下面命令搜索某軟體安裝信息

apt-cache search baseutils

安裝軟體直接輸入下面命令,apt-get 會根據依賴關係,自動下在該程序需要的庫文件等。

apt-get install baseutils

刪除某軟體使用

apt-get remove baseutils

得到該軟體在源中的可用信息

apt-cache stats

比如返回:

Total package names : 22502 (900k)
Normal packages: 17632
Pure virtual packages: 281
Single virtual packages: 1048
Mixed virtual packages: 172
Missing: 3369
...

升級 ubuntu 版本時使用(慎重啊,兄弟,我在升級 breeze 到 dapper 時已經犧牲了)

apt-get dist-upgrade

每次 apt-get 安裝軟體都會把安裝文件丟到 /var/cache/apt/archives/目錄中,久而久之,大占空間,用這個命令刪之

apt-get clean

也可以自動刪除,如果系統認為安裝包不有用或者不完整了的話

apt-get autoclean

dpkg

dpkg 是一個輕量級的軟體管理工具。從網上下載的 .deb 文件使用如下命令安裝

dpkg -i gedit-2.12.1.deb

刪除軟體包使用

dpkg -r gedit

注意刪除的時候,只寫軟體名(安裝需要完整 .deb 文件名)

下面命令(-P)刪除更徹底,包括配置文件。(-r 不包括)

dpkg -P gedit

只是看軟體包內容適用 -c 參數

dpkg -c gedit-2.12.1.deb

更多信息使用 -I 參數

dpkg -I gedit-2.12.1.deb

顯示所有相關包

dpkg -l gcc*

比如返回

Desired=Unknown/Install/Remove/Purge/Hold
Status=Not/Installed/Config-files/Unpacked/Failed-config/.
/ Err?=(none)/Hold/Reinst-required/X=both-problems
/ Name Version Description
+++-===============-==============-========
ii gcc 4.0.1-3 The GNU C compiler
ii gcc-3.3-base 3.3.6-8ubuntu1 The GNU Compiler Colletio
un gcc-3.5 none (no description available)
un gcc-3.5-base none (no description available)
un gcc-3.5-doc none (no description available)
ii gcc-4.0 4.0.1-4ubuntu9 The GNU C compiler
...


In the above listing, the first 'i' denotes desired state which is install. The second 'i' denotes the actual state ie gcc is installed. The third column gives the error problems if any. The fourth, fifth and sixth column gives the name, version and description of the packages respectively. And gcc-3.5 is not installed on my machine. So the status is given as 'un' which is unknown not-installed.

-s 檢查是否裝過

dpkg -s gedit

Two days back, I installed beagle (a real time search tool based on Mono) on my machine. But I didn't have a clue about the location of the files as well as what files were installed along with beagle. That was when I used the -L option to get a list of all the files installed by the beagle package.

# dpkg -L beagle

Even better, you can combine the above command with grep to get a listing of all the html documentation of beagle.

# dpkg -L beagle | grep html$

These are just a small sample of the options you can use with dpkg utility. To know more about this tool, check its man page.
If you are alergic to excessive command line activities, then you may also use dselect which is a curses based menu driven front-end to the low level dpkg utility.

apt-get 的 GUI(圖形界面) 版本

* Synaptic (純圖形界面,俗稱 新立得)
* Aptitude (命令行界面)

[火星人 ] 關於ubuntu軟體包安裝模式已經有581次圍觀

http://coctec.com/docs/linux/show-post-182510.html