Saturday, September 23, 2006

Ubuntu software installation using the command line

With the risk of sounding as an Ubuntu beginner's guide, I noticed that the procedure of obtaining software for my Ubuntu installation using the command line wasn't described as explicitly as I'd prefer anywhere, so here goes:

The tool you need is apt-get. What it does is it basically checks through your /etc/apt/sources.list file and queries all the listed repositories for new versions of your OS- and peripheral software - just like Windows Update - but with the added feature of listing and installing new packages, mostly straight out of the box.

Since there's usually lots of managing of system-level files and directories involved in installing, you'll want to run apt-get as super user, using sudo. Hence, the typical command line for e.g. installing Beagle, my favourite desktop search, would be:

sudo apt-get install beagle

And that's usually it! However, if you do come across a package that doesn't exist in any of the default repositories, you might be able to find a specific repository listed on the package's homepage or similar. Then you'd simply have to add a line in the /etc/apt/sources.list file, such as (for XGL stuff):

deb http://ubuntu.compiz.net/ dapper main aiglx

where 'deb' means the repo contains debian binaries (as opposed to source code, 'deb-src'), and 'dapper', 'main' and 'aiglx' mean which distributions you want to access. 'Dapper' and 'main' are the branches of the core Ubuntu files, whereas 'aiglx' holds stuff related to ATI and OpenGL.

So how to know which name a certain program has? Use apt-cache. Two quick examples:

apt-cache search opengl

lists any package related to 'opengl' (by name or description). Wow, that's a lot of packages. If you have a hunch about the name, just 'grep' the output as usual:

apt-cache search opengl | grep compiz

and to get a more detailed description of a certain package, do:

apt-cache show compiz-plugins

That wraps up this tiny - but hopefully useful - post on package installation in Ubuntu, using the command line.

No comments:

Post a Comment