Four expert tips on installing new Linux apps

Sooner or later, we all end up installing new software on our computers. Whether it’s a new version of Firefox, or a cool game, or a video editing package, there comes a time when you want to make your system do more than it can do now.

Under Linux, installing new applications isn’t a particularly hard task, but installations do come in several different varieties, so it’s worth understanding the differences and what you’ll need to know to make them work.

Option 1: Use the built-in package manager

The easiest way to get new software onto a Linux system is to use the integrated package management system that is included with your distribution.

You can use the package manager to download thousands of software packages that have been pre-built and tested for your specific version of Linux.

In Linux, software packages are usually equivalent to applications, although an application may in fact consist of several packages.

For example, a graphics editor app may be made up of a package with the main program, a package with the documentation, and a package with the system libraries that the application needs to run.

One advantage of using an integrated package manager is that it will usually download and install all the related packages that your chosen package depends on. With a live Internet connection, you can download everything you need in one operation.

Another advantage to using the built-in package manager is that the system will periodically check for upgrades to your newly installed package(s), which means that they will stay up to date – although as mentioned below, “up to date” is a relative concept with packages.
The package management system used in Debian-based distributions (including Ubuntu) is called the Synaptic Package Manager and is found under the System menu.

If you know the name of the package you want to install, you can also install it from the command line by typing:
sudo apt-get install packagename – where packagename is the name of your chosen software package.

Be aware that the names can be a little quirky.

Red Hat-based distributions (including Fedora) use a system called PackageKit under the covers. You can get to the graphical front end by going to the System menu, clicking on Administration, and then Add/Remove Program. From the command line, you use:
sudo yum install packagename

Some commercial Linux distributions, such as Xandros, have created integrated package managers that double as storefronts to sell you commercial software. You may need to scroll down a bit to see the free software available for the distribution, but you should be able to find it in short order.

The biggest disadvantage of using a built-in package manager is that the software you want may not be there. For an application to appear in the list of available options, some benevolent party involved in the distribution you’re running has to build and package the software you want in the form you need and for the version of Linux you’re using.

If you’re using an obscure distribution, or unpopular software, the software may be just unavailable altogether.

The second problem is that the packaged versions of software found in distribution repositories tend to lag a bit from the latest versions.

This is mainly because packages have to be built and tested by the distribution maintainers before they’re allowed into the official software repositories for the distributions.

So you might be installing a two-month-old version of the GIMP rather than the current one. Some distributions allow new versions of packages to be added only when there’s a new version of the distribution itself, which can mean that the packages available could be very out of date indeed.

Option 2: Use a third-party package

Some application maintainers offer prepackaged files containing the latest versions of their software on their own sites.

Typically, you’ll find packages for RPM-based distributions (such as Fedora and Red Hat) as well as Debian-based packages, which will usually work on any Debian-based distribution. So, for example, most “.deb” files will work under Ubuntu.

Installing these packages is a matter of downloading them and double-clicking them from a file browser. This should bring up the built-in package installer, which will offer to install the new package for you.

Packages built by third parties offer some, but not all, of the benefits of distribution-hosted packages. They can automatically download other packages from the distribution repository that are required, but unlike distribution-hosted packages, there is no “contract” implied that all the required packages will be available in the distribution repository.

You need to read the installation instructions very carefully to see what other third-party packages may need to be installed, and in what order.

Third-party packaged software won’t be automatically updated by the distribution’s update mechanism. However, it will be part of the database of locally installed packages, which means you can use the integrated package manager to remove it if you need to.

These third-party packages also tend to place files in directories according to the distribution conventions, which makes it easier to find configuration files, libraries, administrative tools, user programs and so on.

Option 3: Use the application’s own installer

A third possibility is that the software won’t be available in a pre-packaged version but will instead come with its own installation program. In other words, instead of using the system-provided tools meant to install applications, the application does everything itself, which usually includes asking you where you want the software installed, making you agree to licensing terms, and so on. Commercial software packages such as the Fortran compiler shown in the screenshot below are fairly notorious for this.

The software usually is available as one big file, which you download somewhere on your desktop.

As a deterrent against malware automatically running on your system, many files that you download via a browser make you explicitly say “it’s OK to run this” before they will run. You do this by setting the “execute” bit on the file.

Let’s say you downloaded an installer called InstallCoolSoftware.bin to your home directory. From a terminal window, you’d type:
% chmod a+x InstallCoolSoftware.bin
% sudo ./InstallCoolSoftware.bin

The first command sets the execute bit on the file. The second command uses the sudo program (which tells Linux to run a program as the “root” superuser), and instructs it to run the InstallCoolSoftware.bin program.

You need to put the ./ in front of the file name because, as a security feature, Linux normally doesn’t look in the current directory for program files.

What happens after this really depends on the software being installed. It might think a bit and then exit, having installed itself without any user interaction.

It might ask you some questions at the terminal, and then perform the installation. Some installers even launch graphical user interfaces to lead you through the process.

The Linux OS is usually oblivious to software installed in this manner. Because it totally circumvents the package management system, you’re completely on your own as far as updating or removing it at a later date.

Updating may involve downloading and running a new version of the installer, and you may even have to uninstall the old version before you can install an update.

Again, the release notes or installation instructions are going to be your best guide to what you need to do.

Option 4: Compile it yourself

There is one final way to install software under Linux, but it’s definitely not for the faint of heart. For some software, the only choice is to download the source code and compile it yourself. At a minimum, you’re going to need to have already installed tools like GNU Make and GCC, the GNU C compiler.

Most sources are packaged in a “tarball” — a tar archive that’s been gzip’ed to reduce its size. For example, if you download a file called “cool-software.tgz,” you unpack it by typing: tar xzf cool-software.tgz at the command line. You can also usually unpack a tarball by double-clicking on the file in the file browser.

If you’re lucky, the software will come with detailed installation notes, but it usually comes down to running a file called “configure,” which figures out which type of system the software is being compiled for, followed by typing: sudo make install – to compile and install the package.

This approach shares all the problems of third-party installers. The distro’s built-in package manager will know nothing of the new software you’re installing.

In addition, doing builds yourself can be fraught with peril. Unless you’re comfortable compiling files and running down the errors that result, you may want to enlist some help from a Linux guru if you need to do an install from scratch.

You may also end up with software installed in unusual locations. For example, a lot of source builds put the programs into /usr/local/bin.

In some cases, if you’re installing a newer version of a program from source, but have already installed a pre-built version that came with the distribution, you could end up with two copies of the program, one in /usr/bin and one in /usr/local/bin. You can change where the software is installed by tweaking the configuration files, but again, it’s not a trivial process and easy to mess up.

In short, building from source should be your last resort, used only when you can’t find a version of your desired software that’s been packaged for your distribution or that comes with its own installer.

Bottom line

As a general rule of thumb, the farther you get from using the system-provided package management system, the more responsibility you have to take for the correct installation of your software.

For popular and stable apps, it’s almost always a smart move to use the built-in package manager, which will ensure your packages stay relatively up to date and live happily with the other software on your system.

It is only when you move into the obscure or frequently updated categories of software that you should need to stray off the well-trodden path.

Would you recommend this article?

Share

Thanks for taking the time to let us know what you think of this article!
We'd love to hear your opinion about this or any other story you read in our publication.


Jim Love, Chief Content Officer, IT World Canada

Featured Download

Featured Story

How the CTO can Maintain Cloud Momentum Across the Enterprise

Embracing cloud is easy for some individuals. But embedding widespread cloud adoption at the enterprise level is...

Related Tech News

Get ITBusiness Delivered

Our experienced team of journalists brings you engaging content targeted to IT professionals and line-of-business executives delivered directly to your inbox.

Featured Tech Jobs