Regardless of the package manager used, there are two ways to install programs on Linux. You either use a ready-made package or compile the program yourself. Nowadays, the former usually wins by default, but there are times when you want to consider compiling from the source code.
What are binary packages?
Installing programs on Linux is usually very different from traditional software installation on Windows. Instead of downloading an installer from a vendor's website, the files come from a repository of programs that is usually tailored to your Linux distribution. You access this repository with a Linux package manager or a Linux app store.
The files that make up the programs in these repositories are in an archive format. This bundles everything in one file for easy access and distribution. For example, Debian uses the DEB format for storing and distributing programs. These bundles are called Binary packages.
You need a special program to extract these files and install them on your computer, usually your package manager or app store. These tools also perform other useful functions, such as: For example, keeping track of the files you have installed and managing software updates.
Where do packages come from?
The entire software consists of lines of text called source code, written in certain programming languages such as C or C ++. In general, you cannot simply bundle this source code in an archive and call it a package. These lines must be translated into a language that your computer can understand and use.
This process is called compiling. The end result creates binary files that can run on your computer. The difference between packages and software is that software binary files are stored together with other things like configuration files in one package
What are configuration files? How to edit them safely
What is the installation of "From Source"?
Installing a program "from source" means installing a program without using a package manager. You compile the source code and instead copy the binary files to your computer.
Most of the time, you can download the source code of a project from hosting services like GitHub, GitLab or Bitbucket. Larger programs can even host source code on a personal website. The code is usually compressed in an archive format (also known as a) Source package).
A special tool set helps automate the construction process. On Linux desktops, this is often done in the form of a command line program called do. Source code written in different languages requires special compilers and commands to convert them into binary files. The make program automates this process.
To make this automation work, make programs with a Makefile that tells him what to do and compile. Nowadays it is usually generated automatically by special software like CMake. This is where you come in. From here you can specify exactly which functions should be compiled into your software.
Create From Source example
For example, the following command uses CMake to generate a configuration file for the Calligra Office Suite. The file created instructs the make program to compile only the Calligra Writer component.
cmake -DPRODUCTSET = WORDS -DCMAKE_INSTALL_PREFIX = $ HOME / kde / inst5 $ HOME / kde / src / calligra
After doing this, one person only needs to run the make tool to compile the results and copy them to their computer. This is done as follows:
While this is the general pattern for compiling programs, there are many other ways to install source packages. For example, Gentoo Linux has a built-in method to handle this and make the process much faster and easier. However, building binary packages requires a few more steps than just the commands above.
Advantages of using binary packages
If you're using Linux, someone most likely has pre-compiled the software you installed. This is far more common than using source packages. But why?
Binary versions are easier to manage
Binary packages contain much more than just compiled installation files. They also store information that makes it easier for your package manager to keep an eye on all your programs. For example, DEB files (the package format for Debian and Debian derivatives) also contain important information, e.g. B. Which other software the program has to run, and the current version.
This makes it much easier to install packages because you don't have to worry about what other files you need to run a program successfully. Your package manager can read this information from the package itself and automatically download any required dependencies.
If you install programs from the source, unless you compile the code into your own binary package, she will be responsible for managing this software. You need to consider what other programs you need to make it work and install it yourself.
Binary versions have improved stability
The people who manage repositories for your package manager
Which Linux Package Manager (and which distribution) suits you?
tend to test binary files for problems and do their best to fix the problems that arise. This can lead to improved program stability, which a person who installed from the source may miss.
Plus packages usually have to follow strict rules to ensure that they run on your system. For example, both Debian and Ubuntu have a policy guide, as do many other Linux distributions.
Some programs also use different versions of the same software dependency to run. Package repositories do their best to resolve these conflicts so you don't have to worry about them.
Advantages of compiling source packages
Installing programs from source is not for everyone, as it is generally easier to maintain your PC if you stick to binary packages. Nevertheless, the use of this somewhat more complex type of program installation offers some advantages.
Source code provides the latest software
A disadvantage of the reliability of programs is that the improvement and correction takes some time. This can lead to the use of older software versions. For people who want the latest and greatest, they may even prefer a bit of instability in return.
There are Linux operating systems that meet this need without compiling programs, but they have some disadvantages. For example, keeping repository software up to date in a repository is more difficult than installing it from the source.
This is because binary packages are usually created from official program versions. Changes between these versions are therefore usually not taken into account. By compiling your own software from the source code, you can immediately benefit from these changes.
It is also possible that your Linux operating system does not have the software that you would like to have pre-built for you. In this case, installing from the source is your only option.
You can choose and choose
Another advantage of using source packages is that you get more control over the programs you have installed. When installing from a binary repository, the options for customizing your packages are limited.
For example, take a look at FFmpeg, the command line based audio and video converter. By default, it has a variety of features, some of which may not even be touched. For example, JACK audio support is available in FFmpeg, although this software is typically only used in production environments.
By compiling FFmpeg, you can remove the things you don't want and make it easier and more tailored to your needs. The same applies to other heavyweight programs.
When resources are scarce, removing features can be a great way to lighten the load. No wonder Chrome OS, which can be found on many low-end computers, is based on Gentoo Linux. Gentoo is source-based and compiles much of its software, which may make these systems run much easier.
Why not install with both?
While you probably don't want to compile packages every day, you should take this into account. That is, with new universal package formats available on websites like the Snap Store and Flathub
Flathub vs. Snap Store: The best websites for downloading Linux apps
You are less likely to need to build from the source code to get the latest software.
Disclosure of partners: By purchasing the products we recommend, you are helping to keep the website alive. Continue reading.