Friday, May 9, 2014

How to install software on your Linux machine?

This article will talk about how to install any software on your Linux machine, if you have the source code. I will not talk about how to install the software from the rpm binary file.

If you already have the RPM file, you can install the software by running

rpm -ivh  filename.rpm

If you want to deinstall from an application installed from a RPM package, you can run

rpm -e <applicationname/processname>
>rpm -e oracle-xe


Here are some of the advantages of installing software from the source code:

1. You cannot find the rpm binaries for your platform
2. Only the source code is provided by the website.
3. You cannot find the latest rpm binaries for the latest source code.

Most of the open source code project will tar and zip the source code in a file like *.bz2 or *.gz.

Here are the steps you need to do:

1. Download the source code. Let's say it is called valgrind-3.7.0.tar.bz2
2. Extract the file.

>tar xvjh valgrind-3.7.0.tar.bz2
or
>tar xzvh valgrind-3.7.0.tar.gz

Assuming the files get extracted into valgrind37 folder
3. cd to the source folder  valgrind37

>cd /valgrind37

4. Configure the software

>./configure  \-prefix=/valgrind37   //run the configuration script. Notice I use to prefix to specify where
I want to install the software. The directory must be an absolute path. If you don't use the prefig, it will install the software in the default location like /usr/bin/.

5. Build the source code
>make

6. Install the sofware
>make install

7. Clean the temp build files.
>make distclean    //you need to run this every time you run ./configure with different prefix values.

8. Set the environment
Most of the time, you only need to set these two environment variables to run any programs.
>export LD_LIBRARY_PATH=/vagrind37/lib/valgrind/:$LD_LIBRARY_PATH
>export PATH=/valgrind37/bin:$PATH




No comments: