Shoot a terminal and install a ball

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.

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!

Praval, the author of this article is available as a freelance writer and technology blogger. He writes reviews and stuffs related to Wordpress, Linux, Information marketing, Open Source Softwares, Life hacks and technology in general. He also provides information marketing solutions to his clients. You may reach him at Praval.com.


Don't like it? There are lots of published articles, pick a random one.

oCricket

Praval Singh posted this article on Thu, Jun 19th, 2008 at 5:56 am
Categorized under Featured, Linux, Technology and has the following tags

Prev Article: Software installation woes on Linux

Next Article: Sharpen your Linux Vocabulary


Possibly Related Articles

Archives: Visit the Archives for more articles.

Comments Post Yours

There are 3 responses so far. You can follow any responses to this entry through the RSS feed. You can leave a response, or trackback from your own site.

  1. If this article is really for newbies, there are some not-so-obvious mistakes here;

    1. “It is advisable to to move it to the directory /usr/local/src” - Cite a source. Very few people keep their source tars in reality, exception being the linux source which people choose to keep in /usr/src or similar.
    2. mkdir /usr/local/src will rarely work as /usr/local is usually owned by root. Therefore, superuser privileges are required to create this directory.
    3. “One, simply right-click on the package and select Extract Here.” will rarely work as /usr/local/src will be owned by root even if created as in the previous step. Either a chown, chmod or superuser privileges are required.
    4. cd /usr/local/src/ — Why? Ever heard of the -C switch in tar?
    5. tar -zxvf and tar -jxvf are deprecated. The new version of tar simply reads the file header and auto extracts it. tar xf is sufficient.
    6. “./configure”, “make” etc - Very generic instructions for packages that use autoconf/ automake. There are tons of packages that opt to differ today. A better instruction would be to read the README/ INSTALL file which is almost always provided with every package. Another flaw is is that while the sources are in /usr/local, your program is really installed in /usr. Ever heard of the --prefix switch?
    7. “make uninstall” - What if this option isn’t available? You’re taking the reader down a path where s/he can’t uninstall the software. Use a package management system to install the software- Create a source/binary deb/rpm out of the source tarball and install that or simply use something like GNU Stow (my favorite)
  2. @Artagnon: Nice to learn that some geeks are also involved here! I’ll try to answer as many as I can. Quickly though!

    1. /usr/local/src is advisable as a practice. It’s not mandatory! Most installations have recommended it. Eg: http://meadvillelibrary.org/os/filtering/squidGuard-install.html
    2. mkdir /usr/local/src would ask you to get to super user mode. That’s obvious. You may refer to one of my last posts, for that matter. I hope my readers are advancing from beginner to intermediate level and have good retention power! (pun intended)
    3. I guess the previous one answers this as well! I haven’t yet talked about a lot of things Linux has and does - chmod, is one of them!
    4. Heh, yeah the -C switch directly extracts the tar ball to a specified directory. But I didn’t consider explaining switches in this very article. I guess you just mentioned - this article is for newbies!
    5. You’re absolutely correct on that. But these methods still work! Thanks for sharing the latest syntaxes with our readers. :)
    6. I did miss out on automake, README and INSTALL thing. Thanks for pointing it out. This article and the future ones shall however share the “generic” ways quite proudly!
    7. I guess I clearly mentioned the disadvantages of a complete command line installation. However, packages like checkinstall help you to to build the required deb. But may be I’ll get on to it some other time. :) GNU stow and other perl based tools are definitely not to be mentioned in such newbie stream articles. I remember how we struggled hard to learn to code on a notepad window before knowing what a NetBeans IDE was! I hope you got my point.

    I thank you for your beautiful words and suggestions. Keep rolling in. I’ll drop in here, once in a while and shout back! Cheers. :)

  1. Pings & Trackbacks Sites, articles & blog posts linking back to this article.

Post yours

Sidenotes

Quick notes, scribbles, somehow related to this website and to what I do. Or perhaps I'm just plain lazy to make them into a full article.

Fedora 10 Released

Let's talk history! Fedora was created in late 2003 as a Linux based Operating System which gives the users an admittance from anywhere in the world to the most up-to-date free and open source software ...28th Nov, 2008

Top 25 Hottest Indian Web Companies

Note: User submitted article. Personally, I would advise not to take this video seriously. 21st Nov, 2008

India gets ready for Free and Open Source Software

Over the years, FOSS.in has attracted thousands of participants, and the speaker roster reads like a "Who's Who" of FOSS contributors from across the world. FOSS.in is a non-commercial event organised and run entirely by FOSS ...21st Nov, 2008

Cooliris for the iPhone

Cooliris is the browser extension that revolutionizes the way you view media on your computer. It is now available as an application for your iPhone! Cooliris for the iPhone allows you to search the web ...22nd Oct, 2008

Adobe releases Flash Player 10 (Mac, Win & Linux)

Adobe have released the shipping version of Flash Player 10 for Mac, Windows and Linux. More about Flash Player 10 * About Flash Player 10 * Get Flash Player 10 (Official Release version 10.0.12.36) * Download Debug and Standalone ...15th Oct, 2008

View the Sidenotes Archive

Play the Penguin Game

Recommended

  • Forum Oinam’s technical discussion forum where developers and designers can discuss all technical topics.
  • Not Safe for Work Ever clicked a link and felt embarrassed with the content in front of your co-workers? Ever caught unaware because the funny link your friend sent was a little beyond funny? Let’s minimize that with NSWF.
  • Ode to Apple Dedicated to Apple - Mac, iPhone, iPod, iTunes, Quicktime, Apple TV and all the awesome softwares for the Apple Mac.
  • AS 2.0 Reference Reference for ActionScript 2.0 Programming Language used in Flash. Primarily stashed here for my own personal reference.
  • o! Just Me Of colorful cultures, entertainment, media, life hacks, music, books and movies from hollywood & bollywood.
  • oCricket oCricket is about Cricket and people enthusiastic about it.
  • My Special Job My Special Job is a place where you can look for your weird necessities, strangely superb employees, when your need are more of those hackers, geeks, and ultimate rockstars in the Internet Technology.

Download free Brajeshwar Wordpress Theme

Brajeshwar

Brajeshwar I firmly believe in keeping things simple, easy for users and I envison pushing the technical envelop time and again for the betterment of viable commercial and practical applications. More about me.

Brajeshwar's affinity with Adobe

My Photos

More photos on Flickr

Member of 9rules Network

Since its inception on 11th June, 2001, "Brajeshwar" has 897 Articles and 6,106 comments, contained within 21 categories and 1,369 tags.