Saturday 2 November 2013

Basics of installing packages in Ubuntu


Now we have got the Ubuntu operating system installed on our PC. So now if we want to install packages we can do it from Synaptic package manager but we can also do it from the Terminal too. So let us learn the basics of doing it in this article.
To install packages:
        sudo apt-get install packagename

For example:
        sudo apt-get install mpd sbackup

To remove packages:
        sudo apt-get remove packagename

To remove all dependencies:
        sudo apt-get autoremove

For example:
        sudo apt-get remove mpd sbackup

To search for packages:
        apt-cache search <keywords>

For example:
        apt-cache search Music MP3
        apt-cache search "Text Editor"

To update the apt package database after adding/removing repositories:
        sudo apt-get update

To upgrade packages:
        sudo apt-get upgrade

To upgrade the entire distribution (e.g. from Maverick to Natty):
        sudo apt-get dist-upgrade

Now we will learn how to install .deb packages from the Terminal
To install a downloaded Debian (Ubuntu) package (.deb):
       sudo dpkg -i packagename.deb

To remove a Debian (Ubuntu) package (.deb):
       sudo dpkg -r packagename

To reconfigure/Repair an installed Debian (Ubuntu) package (.deb):
       sudo dpkg-reconfigure packagename

Now we have seen installing packages and every thing with the help of apt-get from the Terminal. There is another one which can replace it. That is Aptitude. Aptitude is a terminal-based package manager. It marks the packages that are automatically installed and removes them when no packages depend on them. So this is a best and feature present in Aptitude. So to use this replace apt-get with Aptitude through the terminal. Now let us see how to use it in brief.

         sudo aptitude install packagename
         sudo aptitude remove packagename
         sudo aptitude update
         sudo aptitude upgrade

For an ncurses-based graphical user interface, type:
         sudo aptitude
For more information about using Aptitude use the Aptitude documentation from It's official web site.

No comments:

Post a Comment