Wednesday, 16 January 2008


Although the Ubuntu repositories are very comprehensive, from time to time you may want to install something which isn't available from them (such as a more recent version of an application which has a feature you want). As mentioned previously, there are additional repositories you can add which may have these, but not often. More often, you'll have to download and install a .deb package yourself.

Now, apt-get is no use for this, as it only works with the repositories. But dpkg can be used to install any .deb package you wish.

Let's try it out. One of the best resources for finding .deb packages not yet in Ubuntu is GetDeb. This site has .deb packages for many applications not yet in Ubuntu, and others more up-to-date than those in the current version of Ubuntu. Follow this link to get to the page for Micropolis. Look familiar? It's the original Sim City, which has been open-sourced and is now available free for Linux! Click on the link for your version (32 or 64 bit), and download it to your desktop or home directory.

Both Ubuntu and Kubuntu now have graphical tools to install the package if you just double-click on it. But these tend to be quite slow and unwieldy, so let's use the command line. Open Konsole or Terminal, whichever you have installed. Now, you'll need to know the exact name of the package to install it. What I often do is right-click on it, select rename, then Ctrl-C to copy the name of the package to the clipboard. Then press enter to leave the name as it is - don't change it!

All you need to do now is enter the following:
sudo dpkg -i micropolis_0.0.20080114-1~getdeb1_i386.deb

And it will install it for you!

If you got fed up with it, you can remove it with the following command:
sudo dpkg -r micropolis

Note that to uninstall it you don't need the full name, it now has a record of the package and doesn't need all the same information.

Now, what about dependencies? When compared to apt-get, dpkg is not as sophisticated. All it does is install a package as it's told to, it doesn't pay attention to any dependencies. As a result, if you download and install something, you may get a message saying something like this:
matthew@matthew-laptop:~$ sudo dpkg -i pidgin_2.3.1-1~getdeb1_i386.deb pidgin-data_2.3.1-1~getdeb1_all.deb libpurple0_2.3.1-1~getdeb1_i386.deb
Selecting previously deselected package pidgin.
(Reading database ... 124149 files and directories currently installed.)
Unpacking pidgin (from pidgin_2.3.1-1~getdeb1_i386.deb) ...
Selecting previously deselected package pidgin-data.
Unpacking pidgin-data (from pidgin-data_2.3.1-1~getdeb1_all.deb) ...
Selecting previously deselected package libpurple0.
Unpacking libpurple0 (from libpurple0_2.3.1-1~getdeb1_i386.deb) ...
dpkg: dependency problems prevent configuration of pidgin:
pidgin depends on liblaunchpad-integration0 (>= 0.0patch26); however:
Package liblaunchpad-integration0 is not installed.
dpkg: error processing pidgin (--install):
dependency problems - leaving unconfigured
Setting up pidgin-data (1:2.3.1-1~getdeb1) ...

dpkg: dependency problems prevent configuration of libpurple0:
libpurple0 depends on libnm-glib0; however:
Package libnm-glib0 is not installed.
libpurple0 depends on libzephyr3; however:
Package libzephyr3 is not installed.
dpkg: error processing libpurple0 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
This is for the Pidgin IM client, which I've downloaded and installed a new version of from GetDeb. Basically, this means that there are outstanding dependencies which need to be resolved before you can use Pidgin. But here's where apt-get comes to the rescue. You see, apt-get can tell what packages are outstanding, enabling it to resolve the dependencies for you! Just enter the following command:
sudo apt-get -f install
Now, this basically says to apt-get "Resolve any outstanding dependencies", and it will do it with no further input from you.

In this way, you can get software that isn't yet available in the Ubuntu repositories quickly and easily. However, be aware that this does pose a potential security risk, so try to only get .deb packages from websites you trust. Also, packages that aren't yet in the official repositories may not be as stable as ones that are, so you take a certain amount of risk in terms of reliability.

No comments: