Most linux distros have a package manager, that will download and install programs and their dependencies for you. On Debian based distros, such as Ubuntu, this is called apt.
Aptitude is a frontend to apt (see
http://www.psychocats.net/ubuntu/aptitude.php for more about aptitude and apt-get). Other frontends include apt-get, and Synaptic (GUI).
You define a list of repositories, in /etc/apt/sources.list. The package manager will fetch a list of all the packages available in each repository, and store it. When you request a package to be installed, it finds a suitable repository and downloads and installs the program. It also fetches and installs any other packages that your requested packages requires.
I hope this helps
--Ian