Hi there, Today I would like to explain to you about installing the software from source code in Ubuntu. Compiling software from source code is not as difficult as you think. This is a complete guide about installing any software from the source. So get started with today’s article!
The main method of compiling software is Download source code from the developer’s Website and compile it using the terminal.
Download Source code from developers Websites.
Most of the newer version of Ubuntu software that is not available in Ubuntu repositories is available in the developer’s website as a compressed file. These files are available as .tar.xz or .tgz format. In Linux, tar files(also called “Tarballs”) are created using the tar command. Let’s start with a real-life example to learn the practical way to install software from source.
Check the VLC Media player site for download the source code(Tarball).
Download the .tar.xz file. Then we need a new directory to uncompress this file. It is always a really good idea to compile downloaded source code as a regular user to limit any damage, so create a directory named “source” in your home directory. Open the terminal(Ctrl+Alt+T) type this command. Refer this link to learn basic commands in Ubuntu.
[email protected]:~$ mkdir source
Navigate to the Download folder(or wherever you downloaded the source tarball) and type the following command to uncompress the tar file into the ~/source directory by using the -C option to tar command.
[email protected]:~$ tar -xf vlc-220.127.116.11.tar.xz -C ~/source
Let’s discuss each option that I have used in the above command to better understand the entire process.
x – to Extract an archive file.
f – File name of the downloaded archive file.
C – You can specify a different directory to extract the archive file.
Now, change directories to ~/source/vlc-18.104.22.168 and look for a file named README, INSTALL, or something similar to it. (use ls command) That text file included the specific instructions about how to compile and install the software.
In this article, I explain the general method of compiling the software. All additional details and instructions are included in the README text file.
Now run the configure script file to check whether all dependencies are available or not. If you are missing any dependencies in your Ubuntu system, then the configure script normally tells you what exactly one it needs.
[email protected]:~/source/vlc-22.214.171.124$ ./configure
When your configure script succeeds without any errors, run the following command to compile the source code.
[email protected]:~/source/vlc-126.96.36.199$ make
Finally, run the following command to install the compiled software to your system:
[email protected]:~/source/vlc-188.8.131.52$ sudo make install
If you get any error message during the compilation, check the error messages for the reason and run the following command before you start again the compilation process.
[email protected]:~/source/vlc-184.108.40.206$ make clean
You can uninstall the software if you do not like it, run the following command:
[email protected]:~/source/vlc-220.127.116.11$ sudo make uninstall
That’s all about Installing software from source. However, this method is a bit difficult compared with the APT tool in Ubuntu. If you learn something with this article share with your friends and leave a comment with your valuable suggestions!