Linux is open source operating system which means anyone can read and modify its source code. During time developers modified original Linux system source code to some point where they presented it as something totally new. That’s why there is so many different Linux systems(distributions) today. However many so called “distributions” are actually not so different from original. For the sake of installing applications(packages in Linux terms) there are two main package managers and these are Yum for Red Hat based Linux distributions and Apt for Debian based distributions. We can say that the most of the Linux distributions are based on one of these two. Lets see how they work and what other methods we have available for installing applications in Linux.
Linux applications are usually called packages at least before they are installed, because installation process assume additional processes and not only extracting application files but also creation of required directories, users, setting permissions, changing configuration files and even installing dependencies. Dependencies are packages which original application depends on to work properly.
There are two main package types RPM and DEB. First one is used with Red Hat based distributions and second one with Debian based. However when installing packages you should try to find package repositories for that specific distribution. Sometimes DEB packages prepared for Debian won’t work properly on Ubuntu. It’s also advisable to use only trusted package repositories if you can. On the most Linux distributions trusted repositories are usually preconfigured automatically during the process of Linux installation. That means you don’t have to do anything regarding package repository setup.
Sometimes you might need to install an application that does not exists in trusted repositories or any other repository you can find. It’s advisable to research a bit about particular repository you plan to use for application packages and decide if you can trust it or not.
First you should check if application developers provide a package on their own repository. In case they don’t you will need to manually install application which is bit complicated but if you follow installation instructions you will rarely fail, and you will most definitely learn more about Linux. In good old days Linux power users and admins would install everything manually to demonstrate their mastery.
Again, the most convenient and clean method of installing and uninstalling Linux applications is using package manager. Some of the first applications you’ll want to install are command line text editors, so you don’t need to use Vim which is bit more cumbersome as I mentioned in the Linux commands for beginners tutorial. I used to use Joe, Pico and most recently switched to Nano which became de facto standard for command line text editing.
To install Nano in Red Hat based (RPM) distributions use:
yum install nano
To install Nano in Debian based (DEB) distributions use:
apt install nano
In some tutorials authors may refer to apt-get command instead of apt. You can use apt-get as well to get the same result but general consensus is that apt command superseded apt-get. I won’t go into technical details on that matter in this tutorial.
To uninstall application (for example Nano) in Red Hat based (RPM) distributions use:
yum remove nano
To uninstall application (Nano) in Debian based (DEB) distributions use:
apt remove nano
If you remember from Linux commands for total beginners tutorial installation of system wide applications(commands) in Linux requires super-user(system admin) permissions. If you are logged in as normal user you need to prefix installation commands with sudo. Sudo is also a command that in simple terms allow execution of the command that follows (in our case yum or apt) with super-user permissions.
RPM based systems:
sudo yum install nano
sudo yum remove nano
DEB based systems:
sudo apt install nano
sudo apt remove nano
During installation process package manager will ask for confirmation if the package needs to install dependencies to work properly. It’s just additional click on “Y” button during the installation process.
Sometimes there won’t be the option to use package management commands yum or apt because there’s no repository containing application package and you will have to download .deb or .rpm packages, or sometimes even source files.
In case there are working .deb or .rpm packages to download you’re still lucky as installation process is again easy. In following example downloaded imaginary package files are nano.1.3.5.rpm and nano.1.3.5.deb.
rpm -i nano.1.3.5.rpm
dpkg -i nano.1.3.5.deb
Finally, process of application installation using source files is the best because you can optimize application for your specific hardware platform during configuration process. But it’s also a bit more complicated and requires additional documentation reading. However, if you use default configuration process is still simple, consisting of running commands for file extraction, running configuration scripts and then compiling and installation. The most of times you will get through installation from source files by simply copy-pasting commands from application README file.
These days if you plan to work as software developer you will almost certainly meet Linux or some kind of Unix based system (Linux is based on Unix as well as many other operating systems. It’s everywhere, Android is running Linux kernel, Raspberry is using Linux, even MacOS is based on Unix. It’s worth spending some time learning at least Linux basics.