
Some applications can only be installed from source code. Here’s how to do it.
Translated from Linux: How To Install Apps From the Source by Jack Wallen.
When I first started using Linux, there was only one way to install applications… from the original source code. Those days are long gone, and now there are several methods to install software:
-
Source Code
-
Default Package Manager
-
Universal Package Manager
-
AppImages
The most reliable and straightforward way to install applications is through the default package manager (like APT for Debian) and universal package managers like FlatPak. Next is AppImage, which allows you to install Linux applications on any platform.
The last method is installing from source code.
Why is the oldest method of installing Linux applications listed last? It’s not just the simplicity provided by package managers. In fact, there’s a very good reason why you should choose to install via a package manager instead of from source. When you install via a package manager, your system knows about the application.
What does this mean?
Let me give you a simple explanation.
Suppose you install AppX using the default package manager. When you do this, the system knows about the application, so whenever an upgrade is available for that application, it will be applied the next time you run an upgrade with the package manager.
Now, suppose you install AppX from source. The next time you run an update with the package manager, AppX will not be updated. Why? Because the package manager doesn’t know about it and doesn’t have the capability to upgrade applications installed from source.
What does this mean? Well, let’s stick with our example. You installed AppX from source in January, and you regularly updated your system using the default package manager. In December, you check AppX and find it is outdated. Between January and December, the developers of AppX released several updates, including security patches.
Guess what? The AppX on your system is now vulnerable. If you had installed AppX through the package manager, you wouldn’t have this problem.
Another issue (which might be considered more significant) is that applications installed through the package manager and stored in the standard repository of the distribution have been vetted and should theoretically contain no malicious code (because nothing is guaranteed).
Finally, installing from the distribution’s package manager helps resolve all dependency issues, so you won’t get stuck in what is often referred to as “dependency hell,” where you have to install one dependency to resolve another, which in turn resolves yet another dependency… you get my point. I remember spending hours trying to resolve dependencies when installing from source, and it was no fun.
This is not to say you should avoid installing from source at all costs. You may encounter applications that can only be installed from source. When that happens, you may have no choice. If that’s the case, it’s crucial that you check the software yourself to ensure there’s no malicious code in the source.
Okay, you’ve decided to install an application from source, and you’ve ensured that the application is safe. How do you install it?
Let me guide you through the process.
Starting with Dependencies
Remember I mentioned dependency hell? This is often the part that stops most people from proceeding with installing from source. The issue with installing from source is that you must first satisfy all dependencies before you can attempt to compile and install the application.
Typically, there’s a README file in the application’s source code folder that should contain all the information regarding dependencies. Read that file, then start the process of finding, downloading, and installing the dependencies. Sometimes, these dependencies can be installed through your package manager. Other times, AppX may require specific versions of dependencies, which means you may have to install them from source. If that dependency has its own dependencies, you should first try to install them using the default package manager before diving down the “rabbit hole” of source installation.
But how do you actually go about installing it?
Hang tight, we’re almost there.
How Does It Work?
Okay, you’ve downloaded the source code for AppX (or you’ve cloned it from a Git repository). You know the application is safe, and you’re ready to give it a try.
Here’s how it works. I’ll stick with our fictional AppX application example. Before proceeding, you may need to install some necessary components, or you won’t be able to build the software required for the application. If your chosen system is based on Ubuntu, you can usually do this with the following command:
sudo apt-get install build-essential -y
<span>build-essential</span>
package installs libc, gcc, g++, make, dpkg-dev, and more.
On Fedora-based distributions, the command is:
sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel gcc curl cmake -y
Once you have those, you can continue.
After downloading the package, you first need to extract the files. In most cases, these files are compressed and archived using tools like tar. The easiest way is to open the file manager, navigate to the file, right-click on it, and select “Extract Here.” This creates a new directory, usually named after the application.
At this point, you will have a directory named AppX. Use the following command to enter that directory:
Generally, the process looks like this:
./configure make sudo make install
Before running the <span>./configure</span>
command, you may want to browse the configuration files in the source directory, which may contain options that can be configured before running the <span>configure</span>
command. Additionally, the README may contain details about flags available for configuration that you definitely should be aware of.
You can only run <span>make</span>
after a successful run of <span>./configure</span>
, which compiles the application. If the <span>./configure</span>
command fails, you can check the output to find out why (most often it’s due to missing dependencies). If <span>make</span>
is successful, you can run <span>sudo make install</span>
, which installs the executable binaries into directories in <span>$PATH</span>
so that the application can run as expected.
Now that you’ve installed the application from source, you’ll need to check regularly for new updates. If there are any, you’ll have to go through the same process again, which is one of the reasons you should stick to installing applications from the default package manager.