Selamat Membaca Artikel UBUNTU-ID™

Menggunakan Perintah “apt” di Ubuntu

Ovi saat ini akan menjelaskan kegunaan perintah APT.Posting kali ini saya akan merangkum semua perintah-perintah yang menggunakan apt beserta fungsinya, semoga bermanfaat.
1. apt-get update
Perintah ini akan mengupdate daftar package dari repository yang terdaftar di /etc/apt/source.list. Perintah ini dibutuhkan jika anda mengubah isi dari file /etc/apt/source.list.
contoh:
$ sudo apt-get update
[sudo] password for arie: 
Ign http://kambing.ui.ac.id natty InRelease
Ign http://kambing.ui.ac.id natty-updates InRelease                            
Ign http://kambing.ui.ac.id natty-security InRelease                           
Hit http://kambing.ui.ac.id natty Release.gpg                                  
Get:1 http://kambing.ui.ac.id natty-updates Release.gpg [198 B]                
Get:2 http://kambing.ui.ac.id natty-security Release.gpg [198 B]               
Hit http://kambing.ui.ac.id natty Release                                      
Get:3 http://kambing.ui.ac.id natty-updates Release [27.2 kB]                  
Ign http://extras.ubuntu.com natty InRelease                                   
Ign http://archive.canonical.com natty InRelease                               
Get:4 http://kambing.ui.ac.id natty-security Release [27.2 kB] 
........
Fetched 774 kB in 20s (38.2 kB/s)                                              
Reading package lists... Done

2. apt-get upgrade
Perintah ini akan melakukan update terhadap semua package yang sudah terinstall di Ubuntu
contoh:
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
  apt apt-transport-https apt-utils linux-libc-dev
4 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 3,124 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue [Y/n]?
3. apt-get dist-upgrade
Perintah ini akan melakukan upgrade terhadap package yang ada dan menginstall package baru yang dibutuhkan oleh package lama tetapi tidak terinstall pada system kita.
Contoh:
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-2.6.38-10 linux-headers-2.6.38-10-generic
  linux-image-2.6.38-10-generic
The following packages will be upgraded:
  apt apt-transport-https apt-utils linux-generic linux-headers-generic
  linux-image-generic linux-libc-dev
7 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 50.6 MB of archives.
After this operation, 210 MB of additional disk space will be used.
Do you want to continue [Y/n]?

4. apt-cache sarch

Perintah diatas akan mencari program yang akan kita install beserta deskripsinya, misalkan anda akan menginstall aplikasi xchat, maka perintahnya adalah seperti berikut
contoh
$ sudo apt-cache search xchat
xchat-gnome - a new frontend to the popular X-Chat IRC client
xchat-gnome-common - a new frontend to the popular X-Chat IRC client
bleachbit - delete unnecessary files from the system
pidgin-plugin-pack - Collection of Pidgin plugins
xchat - IRC client for X similar to AmIRC
xchat-common - Common files for X-Chat
xchat-gnome-indicator - XChat-GNOME Indicator Plugin
xchat-guile - Guile scripting plugin for XChat
xchat-indicator - XChat Indicator Plugin
xchat-otr - Off-the-Record Messaging Plugin for X-Chat
xchat-xsys - x-chat plugin that can display your current system statistics
5. apt-cache policy
Perintah ini berfungsi untuk melihat versi packages yang akan kita install dan prioritasnya, misalkan anda ingin melihat versi dari aplikasi xchat yang akan diinstal, maka gunakan perintah berikut
contoh:
$ sudo apt-cache policy xchat
xchat:
  Installed: (none)
  Candidate: 2.8.8-3ubuntu4
  Version table:
     2.8.8-3ubuntu4 0
        500 http://kambing.ui.ac.id/ubuntu/ natty/universe i386 Packages
6. apt-cache show
Perintah diatas akan menampilkan semua informasi dari package yang akan diinstall, mulai dari nama package, prioritas, versi, arsitektur, besar file, sampai MD5sum, perintah berikut untuk menampilkan informasi dari xchat
contoh :
$ sudo apt-cache show xchat
Package: xchat
Priority: optional
Section: universe/net
Installed-Size: 840
Maintainer: Ubuntu Developers 
Original-Maintainer: Davide Puricelli (evo) 
Architecture: i386
Version: 2.8.8-3ubuntu4
Replaces: xchat-common (<< 1.6.0-1)
Provides: irc
Depends: libc6 (>= 2.7), libdbus-glib-1-2 (>= 0.88), libgdk-pixbuf2.0-0 (>= 2.21.6), libglib2.0-0 (>= 2.24.0), libgtk2.0-0 (>= 2.18.0), liblaunchpad-integration1 (>= 0.1.17), libpango1.0-0 (>= 1.14.0), libperl5.10 (>= 5.10.1), libsexy2 (>= 0.1.8), libssl0.9.8 (>= 0.9.8m-1), libx11-6, xchat-common (= 2.8.8-3ubuntu4)
Recommends: libpython2.7 (>= 2.7), tcl8.4 (>= 8.4.16), esound-clients | alsa-utils, libnotify1 | libnotify-bin, xdg-utils
Filename: pool/universe/x/xchat/xchat_2.8.8-3ubuntu4_i386.deb
Size: 320094
MD5sum: 56209d777d179f13462d49b0515775ad
SHA1: 5f85f85ee43a358eb178e2dccacd9241b8cddd1b
SHA256: 2624245952dac0a8ad7697d6e12f9149e891757a3749b8e241dedfa3d4cf9533
Description: IRC client for X similar to AmIRC
 XChat is a graphical IRC Client with a GTK+ GUI. It has a look and feel
 similar to AmIRC for the Amiga. Special features include the mIRC extension
 DCC RESUME and mIRC color, multiple server/channel windows, dialog
 windows, and a plugin API.
Homepage: http://www.xchat.org/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Task: xubuntu-desktop
7. apt-cache showpkg
Perintah ini akan menampilkan dependencies yang dibutuhkan oleh sebuah package, perintah berikut akan menampilkan dependencies yang dibutuhkan oleh package xchat
contoh:
$ sudo apt-cache showpkg xchat
Package: xchat
Versions: 
2.8.8-3ubuntu4 (/var/lib/apt/lists/kambing.ui.ac.id_ubuntu_dists_natty_universe_binary-i386_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/kambing.ui.ac.id_ubuntu_dists_natty_universe_binary-i386_Packages
                  MD5: 0370c60ddc73ff6adff8453648bc7334


Reverse Depends: 
  xubuntu-desktop,xchat
  xchat-xsys,xchat 2.4.0
  xchat-otr,xchat
  xchat-indicator,xchat
  xchat-guile,xchat 2.4.1
  xchat-common,xchat
  lubuntu-desktop,xchat
  gnome-osd,xchat 2.0.6
  cwirc,xchat 2.0.2-1
Dependencies: 
2.8.8-3ubuntu4 - libc6 (2 2.7) libdbus-glib-1-2 (2 0.88) libgdk-pixbuf2.0-0 (2 2.21.6) libglib2.0-0 (2 2.24.0) libgtk2.0-0 (2 2.18.0) liblaunchpad-integration1 (2 0.1.17) libpango1.0-0 (2 1.14.0) libperl5.10 (2 5.10.1) libsexy2 (2 0.1.8) libssl0.9.8 (2 0.9.8m-1) libx11-6 (0 (null)) xchat-common (5 2.8.8-3ubuntu4) libpython2.7 (2 2.7) tcl8.4 (2 8.4.16) esound-clients (16 (null)) alsa-utils (0 (null)) libnotify1 (16 (null)) libnotify-bin (0 (null)) xdg-utils (0 (null)) xchat-common (3 1.6.0-1) 
Provides: 
2.8.8-3ubuntu4 - irc 
Reverse Provides: 
8. apt-get install
perintah tersebut akan menginstall package beserta semua dependenciesnya, perintah berikut akan menginstall aplikasi xchat.
contoh:
$ sudo apt-get install xchat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libsexy2 xchat-common
The following NEW packages will be installed:
  libsexy2 xchat xchat-common
0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.
Need to get 1,481 kB of archives.
After this operation, 4,506 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

9. apt-get remove

perintah tersebut akan menghapus atau menguninstall aplikasi yang sudah diinstall beserta semua package yang dibutuhkan tanpa menghapus konfigurasinya
contoh :
$ sudo apt-get remove xchat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  xchat-common libsexy2
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  xchat
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
After this operation, 860 kB disk space will be freed.
Do you want to continue [Y/n]?

10. apt-get autoremove

Perintah ini akan menghapus package yang tidak memiliki dependencies
contoh :
$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
11. apt-get remove --purge
perintah tersebut akan menhapus atau menuninstall program yang sudah diinstal beserta konfigurasinya
contoh:
$ sudo apt-get remove --purge xchat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  xchat-common libsexy2
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  xchat*
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
After this operation, 860 kB disk space will be freed.

12. apt-get autoclean

Perintah ini akan menghapus isi cache di harddisk yang digunakan saat menjalankan perintah apt-get install secara otomatis dengan cara menghapus versi paling lama dari suatu package
contoh:
$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Del compiz 1:0.9.4+bzr20110606-0ubuntu1~natty1 [5,480 B]
Del software-center 4.0.3 [461 kB]
Del libcups2 1.4.6-5ubuntu1.2 [159 kB]
Del cups-client 1.4.6-5ubuntu1.2 [124 kB]
Del cups 1.4.6-5ubuntu1.2 [1,949 kB]
Del cups-bsd 1.4.6-5ubuntu1.2 [42.6 kB]
Del libcupscgi1 1.4.6-5ubuntu1.2 [36.6 kB]
Del apt-utils 0.8.13.2ubuntu4 [223 kB]
Del compiz-gnome 1:0.9.4+bzr20110606-0ubuntu1~natty1 [120 kB]
Del apt-transport-https 0.8.13.2ubuntu4 [19.1 kB]
Del compiz-core 1:0.9.4+bzr20110606-0ubuntu1~natty1 [268 kB]
Del cups-ppdc 1.4.6-5ubuntu1.2 [35.7 kB]
Del libcupsimage2 1.4.6-5ubuntu1.2 [55.7 kB]
Del libcupsdriver1 1.4.6-5ubuntu1.2 [25.7 kB]
Del apt 0.8.13.2ubuntu4 [2,102 kB]
Del libdecoration0 1:0.9.4+bzr20110606-0ubuntu1~natty1 [26.2 kB]
Del libcupsppdc1 1.4.6-5ubuntu1.2 [61.8 kB]
Del cups-common 1.4.6-5ubuntu1.2 [1,274 kB]
Del compiz-plugins 1:0.9.4+bzr20110606-0ubuntu1~natty1 [1,364 kB]
Del libcupsmime1 1.4.6-5ubuntu1.2 [19.5 kB]
jika ingin menghapus isi cache secara keseluruhan gunakan perintah
sudo apt-get clean
13. Memperbaiki dependencies yang rusak
Perintah berikut akan memperbaiki dependencies yang rusak, yang menyebabkan perintah apt tidak bisa di gunakan, dan muncul pesan error, gunakan perintah berikut untuk memperbaikinya.
sudo apt-get -f install

14. Melihat space yang digunakan cache

direktori yang digunakan tool apt untuk menyimpan cache adalah /var/cache/apt/archives/ dan /var/cache/apt/archives/partial/, untuk melihat banyaknya space yang terpakai gunakan perintah berikut
$ du -h /var/cache/apt/archives/
4.0K /var/cache/apt/archives/partial
127M /var/cache/apt/archives/
Semoga bermanfaat, jangan pernah bosan berkunjung ke blog ini...
referensi : Debian GNU/Linux Reference Card, Pake Ubuntu Yuk!

^0^ 0 komentarInfo : Clik Here }

Tuliskan Comentar dan Keluhan

Pepe Ruller. Diberdayakan oleh Blogger.
 
Yahoo Messenger
Send Me IM!
Google Plus
Add Me To Your Circle!
Twitter
Follow Me!
Facebook
Add My Facebook
Original Template By Belajar SEO Blogspot - Himajiesized By Dayz Hidayat