Welcome back! 1
Now you have a good understanding of how to install binary packages using a package manager both on 2
Ubuntu and Centos! Even though this is the recommended way to manage software packages on a modern Linux 3
distribution 4
there are times when you will prefer to compile the application from the source code. 5
Let's see what are the benefits of compiling from source code to installing using the package manager! 6
One advantage of compiling from source is that you can compile applications with certain options which 7
may be missing or disabled in the standard distribution package. 8
Suppose you want to install an FTP server and the ipv6 support is disabled in the binary package. 9
When the server was compiled from source into the binary package, by the distribution of mentainer, 10
ipv6 was not add. 11
What you can do is download the source code and compile the server with ipv6 enabled. 12
Vice versa is also possible. 13
Maybe you are not using ipv6 at all, but it was enabled in the binary package. 14
This means thousands of code lines with possible bugs were compiled in the final application to have 15
a feature that you don't actually need. 16
Another advantage of compiling from source code is that you have faster access to the latest version 17
of an application. 18
Imagine that a security bug was just discovered and the development team, has just released the source 19
code of a new version with the vulnerability patched. 20
There may be some time between this moment and the time the distributor launches a binary package such as 21
a deb file. 22
And in the meantime, you are not protected! If you want to have access to the latest release version, 23
you have to compile the softer. 24
This is at least temporary until the binary package is released! To make it clear 25
let's check the latest version of the Apache Web server on Apache.org on the official website. 26
And it seems that the latest version is 2.4.43. 27
Now, let's check the latest version of the server available in the official repositories of the latest 28
version of Ubuntu. 29
apt show apache2 30
and it's 2.4.41 31
We notice that if we install it from a binary package we won’t have access to the latest version of 32
the server. 33
Also, compiling the sources makes it easy to have multiple versions of the same program installed. 34
Note to mention that you can choose an exact version of a package which may be removed from or not yet 35
present in Ubuntu repositories. 36
In my case, I have several versions of Python in slash /opt directory as I need it to run some 37
older software. 38
Compiling the source code has disadvantages as well. 39
The package manager will be completely unaware of the changes you have made, so it won't be possible 40
to update or remove the application 41
using the package manager. 42
You have to check it manually from time to time to see if the new version was released and compile the 43
new version again. 44
If you are not careful when compiling to install the program in a separate location, you can break 45
your system and compiling is not the easiest job. 46
If you can install and then use an application in a matter of seconds when using the package manager, 47
compiling the same application could be troublesome. 48
You have to dial out the source code from the official website, check its integrity, solve any dependency 49
problems and so on. 50
Let's draw a conclusion! 51
As your first option, always consider installing from standard repositories, using the distribution 52
package manager and after that take into consideration to compile the sources 53
only if you know exactly why you need to do this. 54
Probably you want compiler software from source code on a daily basis, but as an effective sysadmin 55
you need to know how to do it in case you really need it. 56
In the next lecture, I'll show you how to compile from source code.