How to use apt-get in ubuntu

Posted on November 19, 2008

Apt-get is the command-line tool for handling packages in ubuntu.You can use apt-get to install packages,upgrade packages,remove packages,even to upgrade your ubuntu to a new version.

In fact most of these action will interact with the repositories.Repositories are merely collections of softwares which are stored in a public location on the internet. By including the web address of these repositories, you are directing apt-get to search these locations for the desired software. You use the /etc/apt/sources.list file to list the addresses of the repositories. It takes the following format:

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

And below is an example of mine.

deb http://mirror.lupaworld.com/ubuntu/archive/ intrepid main restricted

There are hundreds of repository update servers for ubunt users.So I suggest you to choose a best or fastest update server.
Below will give you some examples of how to use apt-get.

To sync the local software database with the database on the repositories. This will cache a copy of the list of all the remotely available softwares to your machine. This is achieved by running the following command:

sudo apt-get update

After sync all repositories to local database,you can search a specific software from the local database to know if it’s available:

sudo apt-cache search kolourpaint

Once you have figured that the package (in our case baseutils) is available, then installing it is as simple as running the following command:

sudo apt-get install kolourpaint

And removing a package is as simple as running the command:

sudo apt-get remove kolourpaint

To upgrade a software to the new version ,just run the following command:

sudo apt-get update kolourpaint

And if you want to upgrade your ubuntu to new version,you just need to run:

sudo apt-get dist-upgrade
 

tips:To upgrade you ubuntu,you can also refer upgrade your ubuntu

from 8.04 to 8.10

Popularity: 5% [?]

» Filed Under Linux

Comments

Leave a Reply