Home of Rob
Menu
Installing Software on Linux
When I first installed and started using Linux I found it quite difficult to install new software. I was told that Linux had loads of applications available, and all were free! So I download something - and now what? And when I figured out how to install this new software, using some magical incantations, I had absolutely no idea what had happened. How do I run it? Where did it install itself??
So this page is to help those that are new to Linux to get round their system when installing new software. It's directed primarily at Ubuntu (since that's the OS I use) but many items here should apply equally well to other flavours of Linux.
Synaptic Package Manager
First of all, there's no point making life hard for ourselves. In Ubuntu the synaptic package manager is designed specifically to install or remove software for you. You can search for software, see what's already installed, add new software ('packages') or remove old ones. It downloads any dependencies you need, and makes sure things 'just work'. If you install something after using synaptic and it still doesn't work you can check some of the tips later on this page, but the most likely explanation is that you need to check the software help manuals and figure out what it's supposed to do.
Tip: use the man command for help pages - can be technical and opaque, but often a good place to start. Alternatively, try the -help command line option. For example, for help about opera:
man opera
Or:
opera -help
Many Linux applications are designed to be run on the command line, and any graphical interface is considered a bonus (or cheating, perhaps) - using the -help option is a good way of getting some information about how to use the software (if this doesn't work, try --help - yes, I know, why can't there be only a single way to get this information?? I don't know, I didn't write it..)
Installing From Source
It's quite common on Linux to download some software and be presented with the source code. Coming from a windows background, this can be quite intimidating - not to mention completely incomprehensible. There's often little more help than 'build the source and install it', with no explicit instructions on quite what this means.
Basics
First off, when you download some code source you'll likely have a file called *.tar.gz (or maybe *.zip). gz means the file has been compressed using a utility called gzip. tar means that files (and/or directories) have been combined into a single file. So we need to unzip and then 'untar' the file, with the following command (issued from the 'shell prompt' - that is, a console window. On Ubuntu this is found by navigating the menu to Accessories->Terminal):
tar -xvf
This should create a new directory within which is all the source code. Move into the newly created directory and search for any files called README, or INSTALL. If these exist they should explain how to install the software.
If not, the first step is to hope that a file called configure exists. You need to run this file thus:
./configure
This will check your system settings and create an appropriate 'makefile' (this file is used to tell the compiler how to build the software). You may get errors here if you don't have some software installed that you need. If you have any problems in this process (now or later), you should ensure that you have the following installed (at minimum - use synaptic to install them):
make
gcc
These should be installed by default, but just in case...
After running configure, make the software by issuing the following command:
make
You can now install the software with:
make install
It will (hopefully) now be installed!
Next Steps
Ok, so now it's been installed. But where is it? How do we use it?? Again, the first port of call is the code you downloaded. Check for any files called readme.html, or named anything else that implies they may help you to use the software.
If you can't find anything like this, or you can but still want to know what changes have been made to your system, then we can do a few things to track down what's just happened.
First, check the output from the previous steps ('make install', in particular) - this should detail everything the program did.
Generally you'll find that programs will be installed in /usr, in particular /usr/share. There will then be a symbolic link from /usr/bin to the new file. bin is short for binary (that is, an executable file). A symbolic link means that the file in /usr/bin points to the file (like a shortcut in windows, but much more powerful). This organisation means that all the settings, configuration files etc. are stored in one place (/usr/share), while the executables that the system uses are all stored in one place (/usr/bin). When the system tries to run something it searches all directories stored in the PATH environment variable. Use
echo $PATH
to view your path. It will contain /usr/bin but we won't need to clutter up the variable with all the directories in /usr/share because we stick links to them from /usr/bin.
Other Tips
If you're still stuck, you can use the following commands to help find things:
locate
This command uses a database to quickly search for files on your system. The database is updated periodically so if you try searching for something that's only just been added to the filesystem it may not appear (but on the plus side, it's very quick).
find path -iname filename
This searches path for files containing the string filename. The -i argument means the search is case insensitive. You will need to use sudo to search restricted parts of the filesystem. This technique is more thorough than locate, but slower.
whereis file
This command searches all the values in PATH and returns matches for
find path -iname filename | xargs grep text_to_find
This is a slightly more sophisticated version of find (shown above). find has plenty of options that you can use (use man find to get help), but in this instance we pipe the output to xargs. xargs will take each line in turn from find and feed it into grep. grep is a tool for searching for text within files. It handles regular expression matching, and has plenty of options (see man grep); in this instance we merely search for the given text string.