blogger templates blogger widgets
This is part of a list of blog posts.
To browse the contents go to

Install packages in linux

Softwares packages are sometimes downloaded directly from a website without using a packaging tool like apt in Ubuntu.

Read about packaging here.

Lets try installing Lynx, a text based web browser from here.

There are actually 4 steps - untar, configure, make and install. But it could go recursive depending upon the necessary dependencies you need to install.

Step 1:

tar utility provides an option to extract and uncompress in a single step.
-xf : to extract
-z : to uncompress gzip file
-v : to list files extracted
$ tar -zxvf lynx2.8.7rel.2.tar.gz
$ ls -l | grep lynx
drwxr-xr-x 13 onie egroup 4096 2010-06-21 15:05 lynx2-8-7
-rw-r--r-- 1 onie egroup 3421853 2011-06-15 13:34 lynx2.8.7rel.2.tar.gz

$ cd lynx2-8-7/
~/lynx2-8-7$ ls
ABOUT-NLS config.hin COPYHEADER descrip.mms install-sh lynx.cfg lynx.rsp makelynx.bat PACKAGE samples userdefs.h
aclocal.m4 CHANGES config.sub COPYHEADER.asc docs lib lynx_help makefile.bcb make-msc.bat po scripts
AUTHORS configure COPYING LYHelp.hin lynx.hlp makew32.bat PROBLEMS src WWW
BUILD config.guess COPYING.asc INSTALLATION LYMessages_en.h makefile.msc README test

Step 2:

Configure the package.

It's done by running the configure script.
You run the script with this command:
$ ./configure
When you run the configure script, it checks to see if you've got all the dependent programs needed to install the program and assigns values for system-dependent variables. These values are used for generating a Makefile. The Makefile in turn is used for generating the actual binary.
If configure finds an error, it prints it and exits. However, if everything works like it should, configure doesn't complain about anything, it just exists.

Well I got an error message as follows,
configure: error: No curses header-files found

Most modern Linux distributions take care of dependencies for the user. That is to say, if you want to install a program in Ubuntu, the apt program will make sure it installs all needed libraries and other dependent programs so installing a program is never more difficult than just specifying what you need and it does the rest.

Unfortunately with tarballs this is not the case, and you'll have to do it manually. So we google for curses library and finds that the latest version is ncurses 5.9.
Download it's source file. (

Untar and unzip it using the tar command. (Step:1)
cd into the generated folder and run configure script. (Step:2)

Step 3:

$ make
Note that make needs the Makefile for building the program. This is why it's so important to run the configure script successfully, or generate the Makefile some other way.

When you run make, you'll see again a bunch of strange messages filling your screen. Wait for it to complete.

Step 4:

The final step is to install the program.
You do that using the make install command (use sudo or run it as root):
$sudo make install
Now that we have ncurses installed. Let's try to configure lynx once again.(Step:2)

If it works fine, proceed to make and install.(Step:3 and Step:4)
Now let's try out our new program.

Cleaning up the mess

As you might have noticed, there are a lot of files generated in the process.
~/lynx2-8-7$ ls * | wc -w
You can get rid of the files that you don't need and it's effortlessly done using "make clean".
~/lynx2-8-7$ make clean
~/lynx2-8-7$ ls * | wc -w
What about the rest 314 files? However, don't delete the whole folder. There are files that you need to uninstall the program neatly, especially the Makefile.


If you didn't delete your Makefile, you will be able to remove the program by doing a make uninstall:
~/lynx2-8-7$ make uninstall

No comments:

Post a Comment