Installing software in Linux

Saturday, 13 August 2005, michuk

Installing software in GNU/Linux looks quite different to the way you’re probably used to from Microsoft Windows. This is due to philosophical reasons :). GNU/Linux is a free (as in freedom) operating system. Most of the software is free as well. Thus, the programs can better cooperate with each other and often depend on each other for getting a job done.

Installing from packages

Packages are the Linux equivalents of Windows EXE installers. There are different formats of packages though. The differences between these formats are not the subject of this article, but it’s good to know they exist. The most popular are the following three:

Installing software from packages is usually as easy as double-clicking on a downloaded DEB or RPM file. Single packages can be also installed manually. For RPM packages, the magic command is:

rpm -Uvh package_name.rpm

For DEB packages it’s as easy as:

dpkg -i package_name.deb

Installing packages manually get quite cumbersome when the downloaded package has some dependencies. Using a package manager (see next section) is a much smarter choice in such case.

Installing software from repositories

In order to make software installation easier, Linux distributions provide so called software repositories — central servers where the packages are stored (applications, libraries, drivers or pieces of documentation) and stay available for direct installation.
Thanks to the repositories, plenty of apps can be installed in a standard way by using a single program called package manager (or software manager). Each distribution uses its own package manager. The most popular are: APT (Debian systems), Yast (Suse) and Smart (Mandriva, Yoper, etc). The approach with repositories is actually quite revolutionary. The traditional way of installing (proprietary) software includes: searching the web, downloading the app, double clicking on it, hoping there is no malware inside, clicking the “Next” a hundred times, using it. In Linux, a single command is enough to trigger the automatic software download, installation and pre-configuration. Nice?

Installing software in Ubuntu 6.06
Pic 1. Installing new software in Ubuntu 6.06 using the
gnome-app-install applet

Most distros provide their own application for installing software from the repositories. The functionality provided by those package managers is usually searching, installing, removing and sometimes configuring the packages. Almost all package managers provide command-line and graphical user interfaces. Command line is good for quick software installation when we know what we want to do. For example, the following command will install Mozilla Firefox browser in Debian or Ubuntu:

apt-get install firefox

And the next command will search for the packages containing all sorts of codecs:

apt-cache search codecs

In Mandriva, there is urpmi or smart, in Fedora Core yum, in Arch Linux pacman, but all of them provide very similar functionality. The most popular graphical frontend for installing apps is Synaptic, available for both RPM and DEB distros.

Installing software from repositories is the recommended way for most distros, mainly because the package managers take care of the a href=”#dependencies”>dependencies automatically. Only if the package you are seeking is not available in either default or extra repositories (which can be added and searched easily), an alternative way of installing should be used. More about it in the following sections.

Binary installers

This is the way of installing software known from the Microsoft systems. Some applications, usually due to unfriendly licensing (i.e. NVIDIA and ATI drivers) are not available as standard Linux packages (although some distros make “fake” packages including binary drivers, but that’s not the point). When software producer doesn’t release the source code of their application, the only way is to install it in a “black-box” mode (you don’t know what’s inside, you just run the program and hope it works).

Note that binary installers can damage your system if you run them as root (which is usually required to have them do anything useful), since no one except the people who made it know what’s inside. Use them on your own risk. You have been warned.

Installing binary apps is usually as easy as double clicking on the downloaded binary installation file. In order to run the program in Unix-like systems it needs to have an “executable” permission, so it may be necessary to grant this permission to the downloaded file either from the file manager or from command line. The latter looks like:

chmod u+x the_file

When the file is already executable, we can then run it from the command line like this:

./the_file

Note that there is a ./ prefix is used in UNIX to run applications which are located in the current folder. If you wanted to run an application located in a different folder you should type . /path/to/folder/the_file (with a dot a the beginning).

Binary RealPlayer 10 installer in action
Pic 2. Binary RealPlayer 10 installer in action

Compilation and manual installation

Manual compilation of programs is the traditional way of installing software in Linux. GPL-licenced apps are available with their source code which means we can manually compile it and install in our system.
This way of installing software is preferred by some distributions (like Gentoo) as well as most of the BSD systems. If we choose the compilation flags reasonably, we can achieve superior speed and efficiency of the installed app. On the other hand, manual compilation is far from being easy to use since it usually involves manual dependency handling (installing the applications which are required by the program we want to install) and is time-consuming (compiling of KDE or OpenOffice.org can take even a few days!)

In order to compile anything, we need a compiler. We can check if we have one installed in our system by executing in the command line:

gcc --version

If gcc compiler is absent, we need to install it (preferably using the software manager of choice). In some distros, all the applications usually required for building the package from sources are gathered in one meta-package, i.e. in Ubuntu the name of this package is build-essential.

A standard way of installing apps from source code is presented below. Note that the commands need to be invoked in the folder containing the unpacked source code of the application we want to install.

./configure
make
make install

Right now, the software should be installed in our system. If errors occurred, we need to read the messages carefully and probably install additional packages which are required to compile the desired program. The list of dependencies is usually located in README or INSTALL text file which is delivered together with the sources.

As mentioned before, there are distros like Gentoo where building from sources is the default way of installing new software. Portage system with a large repository of packages with source code available allows for a lot easier installation from sources. This looks much like installing packages via APT or urpmi. The command used is Gentoo is emerge. So, for example, issuing the following command:

emerge mozilla-firefox

triggers automatic download of Firefox source code, automatic compilation and installation of Firefox in our system. All the dependencies are downloaded ane d compiled as well, so the only downside is time (compiling can be sometimes really time-consuming).

Compiling from sources has another benefit we haven’t mentioned yet. When building your own package, you can customize the program to your needs. You may remove unwanted features or even get new ones (those that are not activated by default and not used in standard packages). So, sometimes it’s the only option if you need some special, usually experimental feature that is not included in your distribution’s default package.

What are these dependencies?

So, what are these dependencies, anyway? In short a dependency means that one package needs another package for proper functioning. And why is it so? Well, it lays down deeply in the history of Linux and free software. GNU/Linux as a system is all build from modules. There are numbers of programs designed to do one specific task and do it well. Those programs are interconnected with each other and can use the functionality of each other through an open programmers’ API. This way, lots of programs use the same code for typical operations (like cd-burning), but provide a different user interface or other complex functionalities which are independent of the backend. Thus, no redundant code needs to be written, saving the time of both programmers and the users.

There is an alternative to the dependencies which is called static packaging. In short, it means that a single application contains all the required dependencies build in. This is easier to install (no need for installing dependencies) but it takes much more disk space and of course it’s not the optimal way of handling software (it may be that one single app is installed in our systems 10 times, in different software packages). That’s why, dynamic packaging is generally preferred by the Linux distributors, with all its drawbacks (including the so called “dependency hell”). When good package manager is used, the dependency hell is not a big issue though, because the system takes care for handling them nicely on its own. The only popular free OS that uses static packaging is PC-BSD with its PBI package format.

The program is installed. Now, how do I run it?

It’s easy! The programs after installation usually do not create desktop shortcuts unasked. You have to create them yourself if you want to (which is fairly easy in Gnome and KDE). If you installed the program from a package, it usually adds itself to the system menu under an intuitive category. If, for some reason, it wasn’t the case, you can always create the menu entry yourself or run the program directly from the command line.

By default, the executables of the installed apps land in one of the two system folders. The apps installed via package manager should be found in:

/usr/bin

Applications compiled manually and installed via make install go to:

/usr/local/bin

In order to run an application, you need to enter its name in the terminal. Of course you can also use desktop shortcuts or main menu for that as well.

More about software management in GNU/Linux

Subscribe to RSS feed for this article! | Trackback URI

14 Comments

fold this thread james  Saturday, 15 July 2006 o godz. 11:43 pm #  Add karma Subtract karma  +0

Have you seen autopackage [1] ? Could be an interesting compliment to this article.

btw - very nice, thanks :)

[1] http://www.autopackage.org/

 
fold this thread wacco  Sunday, 16 July 2006 o godz. 11:09 am #  Add karma Subtract karma  +0

Great article, but I’m missing one very important thing; uninstall. Most beginners start off trying to install something, and it turns out to be something they weren’t looking for (or they don’t like it, and want to try something else).

 
fold this thread Tom  Sunday, 16 July 2006 o godz. 11:44 am #  Add karma Subtract karma  +1

And, of course Zero Install (a decentralised packaging system that avoids “dependency hell” by choosing versions on a per-program basis, not per-system)

And for completeness, there’s also Klik.

 
fold this thread nikkon  Monday, 17 July 2006 o godz. 9:41 am #  Add karma Subtract karma  +0

nice…is verry usefull for beginers.

 
fold this thread sopas  Monday, 17 July 2006 o godz. 5:58 pm #  Add karma Subtract karma  +0

just to clarify, the “./” prefix does not directly mean “run this app”.

the way the shell works is that it searches for the executable in all the paths specified by the PATH environment variable and by default, it does not include the current path that you are in. so to fix this problem, either you add “./” to your environment path (i.e. export PATH=./:$PATH), or prepend your executable with “./” on the shell prompt

enjoy

 
fold this thread bodhi.zazen  Monday, 17 July 2006 o godz. 9:33 pm #  Add karma Subtract karma  +0

you should mention checkinstall.

It replaces make install

ie:

./configure
make
checkinstall

Checkinstall then packages the source code into a deb package which can be installed and un-installed like any other deb package (ie dpkg -i package_name.deb)

 
fold this thread sekhar  Tuesday, 17 October 2006 o godz. 12:26 pm #  Add karma Subtract karma  +0

i installed xmms plugin in fedora4 but the xmms window not appeared on applications->sound&videos.
tel me the clear procedure to install xmms plugin

 
fold this thread michuk  Tuesday, 17 October 2006 o godz. 1:00 pm #  Add karma Subtract karma  +1

@sekhar: You would be more successful in getting your question answered if you posted it on the nuxified.org forums, as suggested below.

 
fold this thread node  Sunday, 4 February 2007 o godz. 7:39 pm #  Add karma Subtract karma  +1

Awesome this is great article for noobs like me, I only hope to find more great articles like this in the future.

 
fold this thread LinuxRen » Blog Archive » 怎样在Linux中安装软件  Thursday, 3 May 2007 o godz. 6:57 pm #  Add karma Subtract karma  +0

[…] 原文: Installing software in Linux 翻译: LinuxRen […]

 
fold this thread sunny  Tuesday, 22 May 2007 o godz. 11:11 am #  Add karma Subtract karma  +0

I have question that if any software is installed ,is it possible to recreate its installatio file from the installed software?

 
fold this thread George  Saturday, 7 July 2007 o godz. 10:12 pm #  Add karma Subtract karma  +0

I need help!!!
I’m moving from windows to linux and I want to now if can I install my Programs (.exe) in Linux?

And a really good question is what about the drivers of my computer??? How can I install it in a Linux PC?

 
fold this thread michuk  Sunday, 8 July 2007 o godz. 12:45 am #  Add karma Subtract karma  +0

@George: ask questions on http://nuxified.org/forum/ — way easier to get answers there.
And answering your question: you can use Wine to install exe files but it may be that you’ll have to play with it to get it work in some cases. And not all Windows programs are supported. Concerning your hardware — it all depends what hardware you have. If your vendor cares for their users there probably are drivers in any Linux distro out-of-the-box.

 
fold this thread t_ziel  Sunday, 8 July 2007 o godz. 5:02 pm #  Add karma Subtract karma  +0

@sunny
No. It is not possible. HOWEVER sometimes it is possible to recover installation files from cache directory. For example /var/cache/apt/archives/ in Debian.

 
Name (required)
E-mail (required - never shown publicly)
URI

Adjust field size: shrink | enlarge)

You can use simple HTML in your comments. Some examples are as follows:
  • A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
  • Strong text: <strong>Strong text</strong>,
  • Italic text: <em>italic text</em>,
  • Strike: <strike>strike</strike>,
  • Code: <code>printf("hello world");</code>,
  • Block quote: <blockquote>Block quote</blockquote>