Most of windows users who switch to Linux are befuddled when they download a software and end up with a file with extensions like “tar.gz” or “tar.bz2” contrary to straight away setups, as seen on Windows OS “.exe” or “.msi”.
Windows OS users are accustomed to installing software by downloading a setup package, and following through the installation wizard and complete the installation like a PRO. On Linux the story is quite different, you may get a handful of apps which are available as setup files, but many apps are archives of source files. The process of installing software from these source files may seem arduous for Linux newbies but once you understand the procedure you will find it’s really easy.
These are the tools required for compiling the source files. The method to install these tools depend on your distribution.
The packages required on Ubuntu/Linux Mint can be installed be executing the following command in the terminal,
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
On Fedora, execute the following,
sudo yum -y install gcc ncurses-devel
The command begins with a “sudo” because root access is required for installing packages, if you do not have access to the root account then you cannot install these.
Once you’ve installed build tools you are ready to compile and install the software.
Step 1: Extract
First we need to extract the source files from the archive. Execute the following commands to extract the source:
tar -xvjf ‘archive name’ (for .tar.bz2 files)
tar -xvzf ‘archive name’ (for .tar.gz files)
tar -xvzf bison-2.3.tar.gz
After extracting the sources navigate into the source directory, there you will find README file, you may want to read through as it contains details about the ‘to be installed’ software, the license, and instructions for installation.
Step 2: Configure
In this step we need to configure the software. To configure you just need to run the configure script using,
In this step the script checks whether your system is ready for compiling the sources. If you did not install the build tools you may get an error message during the check.
Once the script has finished it’s execution without any errors it will generate a “Makefile” in the source directory.
The Makefile is required as it is used by the “make” utility to compile the sources.
Step 3: Compiling
After the “configure” script has been successfully executed and a “Makefile” is generated, you can start compiling the software by executing the following command
make -j’number of cpu cores+1′
make -j3 (without spaces in between. Enter 3, if your processor is Intel core2duo)
Step 4: Installation
Once the compilation is finished and there are no errors, your software is ready to be installed.
To install execute the following command,
sudo make install
Step 5: Cleanup
During the compilation process many temporary files are created that you no longer require. You can delete those files to free up disk space by executing,
You may want to keep the Makefile though, as it will be required if you wish to uninstall the software.
To uninstall the software execute,
sudo make uninstall