Binary and Source Package: Which should be used?

What are the Binary Package and the Source Package? Why should you use these two packages to install programs on Linux?

Regardless of which package manager you use, there are two ways to install programs on Linux. You can use the pre-set package or compile the program yourself. Currently, people often prefer to use what is already the default, but there are times when you should consider compiling a program from source code.

What is the binary package?

Installing programs on Linux is different from installing software on Windows. Instead of downloading the installation file from the vendor's official website, the Linux program files come from the repository of software tailored to the Linux distribution you use. Access this repository using the package manager or the Linux application store.

Picture 1 of Binary and Source Package: Which should be used?
Package format on Debian

Program files in these repositories have archive formats. It helps put everything into a single file for easy access and distribution. For example, Debian uses the DEB format to store and distribute programs. This is called binary package.

You need special software to decompress these files before you can install them on your computer, especially the package manager or application store. These tools also have many other useful functions, such as tracking the files you have installed and managing software updates.

Where do these packages come from?

All software includes source code, written in specific programming languages, such as C or C ++. In general, you can simply put this source code into an archive and it's already a package. These lines need to be translated into a language that your computer can understand and work.

This process is called compilation, and the end result is the creation of binary code that your computer can run. The difference between packages and software is that software binary codes are stored together within a package, with other things like configuration files.

What is the 'From Source' setting?

Installing 'from source' means installing the program without using the package manager. Instead, you compile the source code yourself and copy the binary files to your computer.

Picture 2 of Binary and Source Package: Which should be used?
Emacs - Makefile

You can mostly download project source code from hosting services like GitHub, GitLab or Bitbucket. Heavier programs can even host the source code on a personal website. They will usually be compressed in archive format (also known as source package).

There is a special set of tools to help automate the process. On Linux computers, this toolkit usually appears as a 'make' command line. Source code is written in different languages ​​that require specific compilers and commands to change them into binary structures. Such a tool automates this process.

For this automation to work, the software must provide makefile telling it what to do and start compiling. Currently, it is usually created automatically by special software such as CMake. From here, you can specify exactly which features you want to compile into your software.

Benefits of using the Binary Package

In the Linux operating system, the current software seems to have been compiled. This has become much more common than using the source package. Why?

Binary version is easier to manage

The Binary Package contains more than just pre-compiled installation files. They also store information that makes it easy for your package manager to keep track of all software. For example, DEB files (the package format for a Debian distribution) also contain important information such as what software to run and its current version.

Picture 3 of Binary and Source Package: Which should be used?
Package data can be easily managed

This makes binary packages much easier to install, because there is no need to worry about files other than what you need to install the software. Your package manager can read that information from the package itself and automatically download all the necessary additional files.

When installing the program from source, unless you compile the source code into your own binary package, you will be in charge of managing the software. You will need to remember the other programs that are needed to make it work and have to install them yourself.

The Binary version has been improved to be more stable

Those who keep the repository for package managers tend to check binaries for problems and try their best to fix the errors that appear. This improves the stability of the programs, which is something that cannot be installed from the source code.

Moreover, packages often have to follow a strict set of rules to help ensure they can run on your system. For example, both Debian and Ubuntu have policy guides as well as many other Linux distributions.

Benefits of self-compiled installation packages

You do not need to install the program from source, as the binary package makes it easier to maintain your PC. However, there are some advantages to using the program from source.

Source code always has the latest version of the software

The downside of creating a program is that it takes a long time to improve and fix. As a result, you may end up using an older version of the software. For those who have always loved newness, they will probably choose to install from source.

Because binary packages are usually taken from the official version of many software, changes between versions are often not noticeable. You will immediately see the benefit of this problem when installing the self-compiled source program.

Update 13 July 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile