Linux玩家都習慣用指令安裝軟體套件,Debian系統首先以dpkg (Debian package) 來轉散播體套件,但dpkg是較底層的工具,安裝dpkg套件間的複雜關聯性,不是一般工程師可以熟悉得來的。
dpkg is the software at the base of the Debian package management system.dpkg
is used to install, remove, and provide information about .deb packages.dpkg
itself is a low level tool; higher level tools, such as APT, are used to fetch packages from remote locations or deal with complex package relations. Tools like aptitude or synaptic are more commonly used thandpkg
on its own, as they have a more sophisticated way of dealing with package relationships and a friendlier interface. (From: Wikipedia/dpkg)
不同Linux系統常用安裝軟體套件的工具分別為:
- Ubuntu / Debian: apt-get (Advanced Package Tool)。
- Red Hat / Fedora / CentOS: yum (Yellow dog Updater, Modified)
distribution 代表 | 軟體管理機制 | 使用指令 | 線上升級機制(指令) |
Red Hat/Fedora | RPM | rpm, rpmbuild | YUM (yum) |
Debian/Ubuntu | DPKG | dpkg | APT (apt-get) |
Ubuntu使用的apt指定,就可以把常用的軟體套件,寫在一個shell檔案,新系統隨時可以執行,一次安裝全部軟體。
The Advanced Packaging Tool, or APT, is a free user interface that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants.[3] APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code. [3] There is no single "apt" program; apt is a collection of tools. (From: Wikipedia/APT)例如:常用的vlc和zip相關軟體,可以將以下字串存於.sh檔。
# VLC Player and plugins
sudo add-apt-repository ppa:videolan/stable-daily
sudo apt-get update
sudo apt-get install vlc vlc-plugin-pulse
# rar and zip
sudo apt-get install unrar-free
sudo apt-get install p7zip-full
常用的apt指令如下:記得前面加上「sudo 」用ROOT權限才能安裝
- apt-get update # 安裝軟體前,可先執行更新
- apt-get upgrade # 自動找出以安裝軟體的新版軟體套件,並一一升級
- apt-get install 要安裝的套件名稱
- apt-get remove 要移除的套件名稱
- apt-cache search 套件相關的關鍵字 # e.g. apt-cache search zip | grep 7zip
grep is useful to filter off long strings and identify desired patterns |
- apt-get clean #清除暫存套件 .deb 檔案 (/var/cache/apt/archives)
.deb source files佔了快1 Gb space! |
apt-get clean執行後,一秒清空! |
- apt-get check #安裝有問題時,用來診斷問題所在
參考:http://b9532026.wordpress.com/2010/03/30/apt-get-%E6%8C%87%E4%BB%A4%E4%B8%80%E8%A6%BD-2/
補充:若要更新軟體,可用terminal以下列指令完成,這樣比用滑鼠更新快多了 (但少部分更新還是要用系統的更新功能)。
sudo su - # 以root帳號登入,隨時在console保持此root權限登入的terminal
apt-get update # 更新套件
apt-get upgrade # 更新軟體
補充:若要更新軟體,可用terminal以下列指令完成,這樣比用滑鼠更新快多了 (但少部分更新還是要用系統的更新功能)。
sudo su - # 以root帳號登入,隨時在console保持此root權限登入的terminal
apt-get update # 更新套件
apt-get upgrade # 更新軟體
No comments :
Post a Comment