A Look Inside Linux series
A series of short topics on how Linux works and how to make it work the way you want it to, which I present during the weekly sessions of the Linux User Net. The target audience is Hams who are new to Linux and want to know more about it, as well as experienced Linux users who can learn more about their chosen operating system. These are my notes for the presentations. (Russ, KC7MM)
In the previous Look Inside Linux, we covered installing pre-packaged software on a Linux system. That certainly is the easiest way to get the programs you need, and is ideal if that software is available in a package.
But what happens when you want to install an application that isn't available as a package, or you need a different version than the one in a package? You might be able to obtain the app's source code, and install it from that.
This is a feature that is exclusive to FOSS – Free and Open Source Software. You can obtain and modify the source code. You can't do that with proprietary software.
Explain how a program is written.
The source code itself can't be executed. In order to run the program, the plain-text source code needs to be transformed into a set of instructions that the computer's CPU can understand: machine language. That conversion process is called compiling. There are several ways of dealing with this:
javacbytecode compiler that produces Class files (file extension
.class) and the VM in which to run them. Python works in a similar fashion, but without the separate compiler. It automatically produces its bytecode files the first time a program is run (with a
In all cases, the program needs to have the correct compiler/interpreter and environment – tools and dependencies – installed at the time it is compiled.
There are multiple ways of acquiring source code for installation:
We'll look at each one of these in turn.
One of the many great things about Linux is the ready availability of development tools for just about every programming language – and there are lots of them. Every Linux distro can be expected to provide the end user (you), at a minimum, the tools used in its development. The major distributions – such as Debian, Red Hat, Arch, and their derivatives – include dozens of development languages in their repositories.
If you use any of these to develop an application, you can run it using the language's tools – compiler, interpreter, VM. When the application is complete, place the necessary files at an appropriate location in the Linux file system, and you're good to go.
The simplest method of obtaining the source code for an application that will compile to an executable is to download an archive file – a tarball – that contains both the program's source code and instructions that guide compiling and installing it.
It's a compressed archive file made with the tar utility. When used for program installation, it contains the source code, along with related files that are used in the process of compiling and installing the application. These latter include:
A standard utility on Linux systems is make, which can be used to control code compilation. Compiling programs can be a lengthy and complicated process. which make simplifies by allowing the developer to write a script that can be executed in lieu of having to manually run each step at the command line.
The process is configured by way of a MAKEFILE. It contains instructions regarding dependencies, file locations, compiler execution, and more.
This file is read by make, and the instructions it contains are followed to complete the compilation.
maketo compile the code.
sudo make installto install the application on the host.
Clearly, this is much more complicated that installing packages from a distribution's repository.
An alternative to downloading tarballs is to use a source code version control system (VCS) to draw code from an online source code repository.
Git is the most widely used VCS these days. To use it for installing programs:
git pullto download the source.
Interpreted languages are too numerous and varied to be able to cover in detail. But, since there is no need to compile them, they are much simpler to deal with.
In general, installing them involves:
pipfor Python modules.
That wraps up our look at installing software on Linux.
This is yet another area in which Linux grants the user tremendous flexibility and power. Most of the software you'll install can be done the easy way – from a repository using a package manager. But if that doesn't work for you, there are other avenues available that are likely to do the trick. How you go about it is yours to choose.