Installing new programs the hard way
Linux system administrators are tasked to install the programs that users need. But sometimes, more advanced users may want to install their own programs. A few common methods are described here.
1.
Compiling, then calling the installation procedure that the program developer designed for you. To do this, just look for a file called README or INSTALL. Most of the time, instructions are
./configure make
These two commands take care of compiling the program. This may be enough in some situations to start using the program. But often, one more command is needed to properly install the program, and it requires root access. Being root means that you're administrator of the system. If you didn't know that, it is quite likely that you do not have root access. If you had, all you'd need to do to install the program would be:
sudo make install
Anyway, this whole process sometimes ends with an error, because of missing dependencies. Let's not go down the rabbit hole of installing dependencies, unless one's really desperate.
2.
If a good soul has already pre-compiled the program for your linux distribution and has gone the extra mile to make it available, then installing is easy: through the system package manager. Let's assume here that you're running Debian or Ubuntu, so the package manager is apt.
If you do not know the exact program name to install, let's say you're looking for BLAST:
apt search blast
It will return a (possibly long) list of programs, including the one you are looking for: ncbi-blast+. Then just type:
sudo apt-get install ncbi-blast+
Easy! In fact XKCD has you covered for many package managers:
Well, although this is meant as a parody because you're unlikely to have all of those (many are specialized), this comic could actually be used in practice.
Small appartĂ© here. âHaving root privilegeâ essentially implies that you can use the command sudo. It allows programs to alter the system. Here, sudo apt-get means to run the program apt-get, with the permission to write stuff to any folder, including the system configuration /etc, and where system programs generally are, /usr. Writing to those folders is typically what is needed to install a program in the system.
The benefits of apt-get are that
it's the easiest way to install a program,
all users of the system can then run the program.
System-installed programs then often reside in /usr/bin/ or /usr/local/bin/ (the difference between those folders is too subtle to be covered here, but you can google it), and those folders are in the PATH environment variable of everyone.
3.
Okay, but sometimes, especially at work, you are not root on the system. So how to proceed? apt-get is out of the question. There a few ways,
./configure --prefix=$HOME make install
is a good one. Then you only need to put $HOME/bin in your PATH, and youâre set:
export PATH=$HOME/bin:$PATH
What this command does is tell your system that whenever you type a command, it has to look for inside $HOME/bin to see whether your command is maybe a program in there.
Small apparté again, regarding shells. A shell is a small program that handles some things behind the scenes related to the command line in your terminal. To find out which shell you have, type echo $SHELL. The export command above is assuming you're running the bash shell. Maybe you need type something else like "setenv PATH $HOME/bin:$PATH" in the tcsh shell.
To make this PATH permanent, just add the export line to your ~/.bashrc or ~/.bash_profile, whichever exists (or ~/.tcshrc).
Anyway, this whole install procedure with the --prefix trick is fine solution as long as your system has all the dependencies that your program needs. By the way, a dependency is typically another program or a library. A library is not exactly a program, but think of it as a piece of a program that can only be used by another program. But maybe you already knew this.
So, this was about installing programs the hard way. In another blog post, we will cover the easy way: non-root package managers, such has linuxbrew and bioconda.














