The apt-get command is a powerful command-line tool used to work with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
Being a simple command-line tool, apt-get has numerous advantages over other package management tools available in Ubuntu for server administrators. Some of these advantages include ease of use over simple terminal connections (SSH) and the ability to be used in system administration scripts, which can in turn be automated by the cron scheduling utility.
Beberapa contoh penggunaan dari perkakas apt-get:
Menginstal Paket: Instalasi paket menggunakan apt-get sangatlah mudah. Sebagai contoh, untuk menginstal network scanner nmap, ketikkan hal berikut:
sudo apt-get install nmap
Menghapus Paket: Proses untuk menghapus paket di Ubuntu sangatlah mudah dan dapat langsung dilakukan. Untuk menghapus paket nmap yang telah diinstal dalam contoh sebelumnya, ketikkan hal berikut:
sudo apt-get remove nmap
![]() |
|
Banyak Paket: Anda dapat sekaligus menginstal atau menghapus banyak paket, dengan dipisahkan oleh spasi. |
Meng-update Indeks Paket: Indeks paket APT adalah database penting untuk paket yang tersedia dari repositori yang ada dalam berkas /etc/apt/sources.list
. Untuk meng-update indeks paket lokal dengan perubahan terbaru yang terjadi dalam repositori, ketik hal berikut:
sudo apt-get update
Upgrade Packages: Over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updates). To upgrade your system, first update your package index as outlined above, and then type:
sudo apt-get upgrade
If a package needs to install or remove new dependencies when being upgraded, it will not be upgraded by the upgrade command. For such an upgrade, it is necessary to use the dist-upgrade command.
Also, you may upgrade your entire Ubuntu system from one revision to another with dist-upgrade. For example, to upgrade from Ubuntu version 6.06 to version 7.04, you would first ensure the version 7.04 repositories replace the existing 6.06 repositories in your computer's /etc/apt/sources.list
, then simply issue the apt-get update command as detailed above, and finally, perform the actual upgrade by typing:
sudo apt-get dist-upgrade
After a fairly considerable amount of time, your computer will be upgraded to the new revision. Typically, some post-upgrade steps would be required as detailed in the upgrade notes for the revision you are upgrading to.
Aksi dari perintah apt-get, seperti instalasi dan penghapusan paket, tercatat di dalam berkas log /var/log/dpkg.log.
For further information about the use of APT, read the comprehensive Debian APT User Manual or type:
apt-get help