Shoot a terminal and install a ball

Music on Tux

Photo by Pilax

Music on tuxInstalling a software was never so easy.

In our last article — Software installation woes on Linux — we proved that installing a software package was as easy as it was rumored otherwise. We saw two pretty common and of course easy ways of software installation.

As promised, we shall now put our eyes down for the third and by far the most scaring way. Trust me, it is not at all as geeky as you have always figured it out to be. Following some easy steps by understanding what is each one of them doing shall help us master this art in sometime. Once you’ve learned, this would be a cakewalk just like the other two, previously described ways.

Before we move on, we should know the forms in which a source code package is available. Generally, a source code comes as a bundle which is a compressed file having an extension — .tar, .tar.gz, .tgz, .tar.bz et al. They are often known as tar balls! Something similar to the zip or rar files you would have possibly come across on a MS Windows installation. But there is a difference in their composition, which we shall not bother to understand for now.

The source package often contains un-compiled source code. But trust me, you need not be a programmer to know how to proceed with compilation and installation of a package with the source code. Decades ago, with *nix systems, this was the sole way to install a software or a tool. Even today, this is one of the standard ways of installing packages on a Linux machine. Remember, this may not work in every case, but it will in most, provided you have the right dependencies installed.

Let’s proceed to get things done or what we better term as GTD today! Before moving on, you must have the compiler tools installed. They all come with the package – build-essential. Install it using Synaptic for now. When you’re sure you have the compiler tools installed, locate the software source on the the website (Quite normally, a software built for Linux has its source code available on it’s own website in one of the compressed file formats.) and download it on your system. There after you need to extract it somewhere.

  • It is advisable to to move it to the directory /usr/local/src (if the directory is not present, your may create one by using mkdir /usr/local/src or by a right click of your mouse!).
  • Now again, there are two ways of extracting the contents of the file.
    • One, simply right-click on the package and select Extract Here.
    • Secondly, shoot a terminal and navigate to /usr/local/src/ using the cd /usr/local/src/ command. For the files ending in .tar.gz, use tar -zxvf <filename> to get the content. Similarly, the files ending in .tar.bz2 can be decompressed using tar -jxvf <filename>.
  • You would see a new directory in your present working directory. Use the command ls to see this directory name. Use the cd <directory-name> to navigate to this newly extracted directory. Remember, all this could have been done just with a few clicks of your mighty mouse! But here, we are trying to explain how things get done on a terminal. Believe me, it looks so fascinating while it’s been done on a terminal!
  • Moving on to the final stages, there are 3 prime tasks we do on a terminal while installation:
    • Configuring the installation
    • Compiling the software
    • Installing the binaries

Configuring the installation

The pre-installation configuration is done by executing a ./configure while you are in the correct directory. The aim of the configure script is to check for the dependencies and then create a makefile. In case, the script fails for some reason and tells you to install certain packages (which may happen quite often than not!), try to locate those names in Synaptic and install them (even if the name comes with an added -dev extension, install it as well. They are the development packages needed for compiling). There may be prompts like – there is no configure script. Do not worry, several packages do not come with one.

Compiling the software

Compilation is a process of turning the source code into an executable binary. When we type and run make. It reads the instructions in the Makefile and builds the application binaries.

Installing the binaries

Wait, we’re almost there. To install, just type sudo make install and voila! It’s all done. To remove the temporary files you can run make clean. To uninstall the program you run sudo make uninstall after navigating to the same directory whenever needed. Remember, the make clean and make uninstall commands shall only work if the programmer would have enabled them to.

You may now try your hands on a couple of tar balls to have an expertize. More from me, very soon. Stay connected!

Software installation woes on Linux

Windows Vista Everything Included

Illustration from Let’s Learn Linux

Everything IncludedMicrosoft Vista comes built-in with everything!

While we gracefully installed our favorite Linux distro, one of the mundane problems which most users face is – installing a new software. In the beginning, software installation on a Linux distro can seem extremely intimidating while using a terminal but more often than not we can install things graphically. Installing software on Linux is not only easier than most of us think, but it also has some special features which help software’s to be updated automatically!

Primarily, there are 3 main ways to install a software on Linux.

  • Downloading a package which is a .deb/.rpm file.
  • Using apt-get with a software repository.
  • Lastly, by compiling the source yourself – we shall take this in an elaborated article, very soon.

Downloading a package which is a .deb/.rpm file

The first way of installing software is by using a .deb/.rpm file. As mentioned in one of our previous articles, .deb refers to installation files associated with debian based distros and .rpm files are RedHat based package manager files.

Here and thereafter, we shall concentrate on .deb files whenever we happen to encounter both the flavors. Remember that there is not much of a difference in the way they’re executed. It it is just that how these are fabricated depending on the underlying distro they are meant for – debian or RPM based.

Coming back to the first way of installing software, this method is pretty similar to installing a software on a MS windows with an executable file. Just download a .deb file for the software you want to install, double click to open it via the default package manager- synaptic in case of ubuntu (debian) and type in your password when prompted. We hope you’d have speculated which password should this be! Installing a software by this method shall automatically check for any additional dependencies you may need and will download and install them too.

One of the disappointing fact about this type of installation is not every program created for Linux has a .deb for users to use for installation. Also, new programs generally do not have a .deb at first until they get more users and popularity. Lastly when the software is updated it will not automatically update, you will need to uninstall it then grab the new .deb package.

A great website to get .deb packages for popular Linux programs is getdeb.net.

Using apt-get with a software repository

The second way of installing programs is by using a software repository. The advantages of installation through a software repository is that when a program is updated, the update manager will let you know and you can update all such software’s with click a few clicks. Most Linux distributions have several popular programs built into there own software repositories which are already set up for you to use.

Depending on your knowledge there are again two ways of installing softwares from a repository. Most modern Linux distributions have a built-in GUI way to find and install software.

For example, on Ubuntu if you navigate to System > Administration > Synaptic Package Manager. Within the package manager, a complete list of software’s is available. One can select and install them with a few clicks of the mouse button. A user can even do a search for a software. Secondly, we can also use the repositories by the CLI.

Shoot a terminal and type, “sudo apt-get install <software-name>” without the quotes. The sudo command gives the computer root privileges to be able to make an installation. Apt-get command tells the computer to get software from the repositories, download and install it.

There may be several software’s which may not be located in the repositories that your Linux distribution manages and comes with, as a default. In such an event, you may have to add more repositories. In Ubuntu you can add a software repository by navigating to System > Administration > Software Sources.

In the window that pops up, choose the “Third-Party Software” tab and click the “add” button. Copy and paste your repository address in the desired location. A repository address will look something like this: deb http://archive.ubuntu.com/ubuntu/ hardy main.

Out of the 2 ways, which we’ve discussed, the best one is to install a software by using a software repository. This method is fairly easy and keeps the software’s up-to-date automatically.

Compiling the Source

The third method is one which is universally valid for all linux distros and is pretty common amongst the Linux pros and geeks. I’m sure we all would love to have a hands-on session on the same. But this is a more detailed and (may appear to be) a tedious process for the newbies. For this very reason, we’ll take care of the command line source compilation method in one of our upcoming article. Stay connected!