How to install *.tar.gz files on linux
Sometimes when using Linux you need to install a version which is not on your package manager or it's not available. In this tutorial we will explain how to install tar.gz files on Linux.
Files with the tar.gz extension are compressed files (gz) which containes many files (tarball). Linux software is usually shipped in tar.gz files which contain source code and required files to build the software. Usually you should use your package manager to install software in Linux, but sometimes you need to install software from source code.
Sometimes tarball files are crompressed with bz2, tgz or xz.
Step 1: Uncompress tarball
To open the tarball you can use the tar
command with the parameters xf
which will detect the compression type:
mkdir source_code # just in case we create a file for the extracted files
cd source_code
tar xf file.tar.gz # or bz2 or xz or tgz
Step 2: Compile source code
Most of the linux source code uses a Makefile to compile the whole project, but this could change from project ot project. The most common way to compile the source code is:
./configure
make
make install
The ./configure
will check for software dependencies on your system. Then make
will compile the source code and create binary files. make install
will copy binaries to appropiate location in your OS to use later.
Appendix
What to do if the source code is missing the configure script?
Sometimes source code misses the configure script, in those cases check project build documentation (usually on github wiki).
Try to check if there is a bootstrap.sh
file or if the project uses autoconf.