How to compile aplications from sources in Linux

There are some cases when you need to install an application that isn’t in your distro’s repos, and you can’t find it in an installable format (like .deb or .rpm) either.

Watch Free Movies

Your last option is to compile it from sources.

Extracting the archive:

Usually, the sources are tar.gzip or tar.bzip2 archives. So, the first step is to extract the files. The following commands will extract the tar.gzip/tar.bzip2 archive into the current directory.

$ tar -xzvf foo.tar.gz   OR   $ tar -xjvf foo.tar.bz2

Next you will have to cd into the extracted directory and read the README or the INSTALL files. Sometimes you will get instructions about what you have to do in order to install the application succesfully from the README / INSTALL file. The most applications can be installed by following the next steps.

Creating the makefile

$ cd foo
$ ./configure

Follow the output for errors. You will be warned that some packages are missing and you will have to install them by yourself. After you fix all the possible errors you will get a Makefile.

Compiling the sources

# make

Fix the errors if you get any (and recompile the sources: make). If your compilation is succesfully, you will have to move the executables to the installation folder, by using the next command:

Installing the application

# make install

If you get any errors, try to fix them as well and reinstall the application (make install). The application is succesfully installed, when your make install has no errors.

Note: some people use make && make install. I recommand you to do the two steps separately, in order to fix the errors easier.

Removing the generated (and useless now) temporary files

# make clean

Uninstalling the application

When you need to uninstall the application navigate in the folder with the configure file and run:
# make uninstall

Scroll to Top