In every operating system you find in the world today, there is a software designed for its specification and procedures in which it will be installed in the system. In Windows, all executable programs are in .exe extension. That’s Window for you, but it is quite different in Linux. I would say lots of things have improved in Linux and almost all software you can install and its dependencies are readily available.

For the newbies who are always wondering what kind of software to install in their Linux system, it makes it easy for you because I would be breaking down every single concept for you to understand what package fits your distribution and how to go about installing packages in some Linux distros.

The past years, Linux had lots of issues in organizing their software packages and their dependencies. In fact, sometimes you would install a package, and you find out that there are missing dependencies, and this will make you go back again and search the internet to download the missing dependency. The hope has come to the new generation because life has been made easy since the implementation of package managers in Linux.

Before we get in proper on how Linux packages are installed, I would love you to understand package manager and what repository means in Linux. This will give you an overview and better understanding of the content of this article.

UNDERSTANDING PACKAGE MANAGERS AND REPOSITORIES IN LINUX

This is one of the aspects in Linux that confuses most Linux newbies. Package managers are sub-systems in Linux that manages Linux software packages. It monitors installed packages and keeps track of dependencies

Since there are lots of Linux distributions available out there, it makes it more confusing in understanding which package manager a particular Linux distribution uses. More so, Linux distributions are differentiated by the package manager they use. For example, the Debian-based Linux uses apt package manager with .deb extension as their package file extension while the RedHat-based Linux such as Fedora uses the yum package manager with .rpm as their package file extension and the list continues.

The Linux repositories contain packages that are specifically configured for a specific Linux distribution, unlike Windows Operating system where you have to download and install applications from websites, Linux users have a configured repository which holds all the application they need.

Now, here comes the most confusing part. Where everyone will have to ask, “What’s the difference between a package manager and a repository?” I want you to see a repository as a container or a warehouse that holds your packages (Linux layman’s term of packages are applications), and this container only holds packages so that you don’t have to source for them on some website. I want you to also see a package manager as that tool that handles how your packages are treated. It handles the installation, dependencies upgrade and all. They don’t hold your packages; they are not containers; they are just there to make sure packages are installed in the appropriate order.

In every Linux systems distribution, package managers have a unique tool that knows how to open and install these packages in their systems. They perform a dependency prerequisite check for all required libraries before installing a particular package.

For example, the RedHat package manager tool is the yum tool while that of Debian-based system is the apt-get tool.

I guess this has brought down the confusion. Now we can go down to how to enable software repositories. We will be using the mixture of a RedHat and Debian system to go for this practical

HOW TO ENABLE SOFTWARE REPOSITORY IN LINUX

Most Linux systems have their repository enabled by default, but most such as RedHat have no repository enabled by default that’s why I will be making use of RedHat for a clearer explanation to configure a repository client file

In Redhat they are three major ways in which you can enable a repository on your system;

Register the system to the subscription management service which will automatically configure access to software repository based on the attached subscription

Manually enable a third-party repository. A third party repository are directories that hold software packages which are provided by a non-RedHat source; either from a server, website or local file system

Manually configure a repository from the installation iso file or disc which holds thousands of packages.

This third step is what I will be explaining to you, but I will also make reference to the second method. Please use the same idea to configure a repository if you have one from any third-party site or server.

First, let’s display the configured software repository by running yum repolist command. The repository you see below is from the subscription management service

The first step in creating a repository from your installation iso file is to create a directory and manually mount your iso file in that directory

We have created a directory and mounted the iso file to that directory. We just mounted manually which is not persistent across system boot.

The next step is to create our repository client file in /etc/yum.repo.d/ directory. As seen in the command below, the “packagesrepo.repo” is the name of my repository, and it must end with .repo extension

Make configuration inside the file with the following parameters. For a client file to be valid, four parameters must be present in the /etc/yum.repos.d/filename.repo

Repository ID: A unique ID that identifies the repository. It must be enclosed in a square bracket. It can be a number, word or mixed. For example, [12345]

Name: Label of the repository. Example: name=myrepofile

Baseurl: Link to the repository server. You can use the file path if the repository is located in your local system or FTP, HTTP if the repository is located remotely.

Gpgcheck: To check for the authenticity of the software

You can also add enable=1 (1=Yes and 0=No). It is not compulsory to add that because you can still enable your repository from the command line.

Now we have added our parameters in the /etc/yum.repos.d/packagesrepo.repo

Run the yum repolist command to see if it has been enabled

Our repository is enabled, remember we mounted manually, which means when the system reboots, you will have to mount the iso again. So we have to mount it persistently to make it permanent across system boot.

To mount persistently, we have to make entry into the /etc/fstab file to make our configuration to the file system

The first part is the destination of the iso file; the second path is the destination of the manually mounted iso file; the third part is the filesystem for the iso file, which is iso9660. When you are done adding your values, press the :x to save changes.

Please note that you Must run the mount –a command on the command line to make sure you mounted your device correctly. The mount –a command will return no result when the file system is mounted corrected but will return a result if not mounted properly. Any wrong entry in the /etc/fstab file will make your system to fail to boot upon next boot.

Once all these are done on your Linux Machine, you now have a repository where you can install your application without having to source anywhere for your packages by merely using the yum tool for Redhat-Based systems or apt-get tool for Debian machines

I will be taking you through basic commands on how to use the package manager tool. In this section, we will be making use of the apt-get to show the examples. The same procedure applies to any distro you choose; you just have to substitute the apt-get to the package manager tool of your Linux distro

Before we start, you should know that you can always use the man apt-get or apt-get - -help to display usage information.

HOW TO INSTALL SOFTWARE PACKAGES USING APT-GET COMMAND

Here comes where you have to run installation of software packages you have initially created a repository. The apt-get tool obtains and installs a software package and its dependencies. The same applies to all other package manager tool for various Linux flavors.

In most cases, you might need to download and install other packages from an external source. I know you will refer to what I had mentioned earlier in the article when I said: “in modern Linux; you don’t have to seek for packages from an outside source.” Ya, but this happens in rare cases. It just like you trying to install chrome or vlc, these packages aren’t present in your repository, and personal need might arise when you have to download them.

Even if you barely need this method of installation, you still have to have a basic understanding of how this works.

The first step to go about this is to go to google.com and type the name of the package specifically for your distribution. I believe we all know how to source information from google. Once you get the appropriate link, click on it, and download the file. Note that for Debian systems you will be looking for packages with .deb extension and RedHat, you will be looking for .rpm extension

Once downloaded, you get an option to save or open. You can choose to save and install from the GUI. Note that most Linux distro won't provide the option to install from the GUI, you just have to install from the CLI. Don’t worry if the letter is the case. Open your terminal and change directory to where the package was downloaded and run the apt-get command with the package name. Example: apt-get [PackageName]

HOW TO UNINSTALL SOFTWARE PACKAGES USING APT-GET COMMAND

To remove installed package, run the apt-get remove [PackageName]. This command will also remove other packages

HOW TO UPDATE PACKAGES USING YUM COMMAND

You can as well update your software packages including any dependencies. The system tries to preserve the previous settings of the package when a newer version is installed, but some times, the system changes the settings if it thinks the previous settings will not work on the latest version.

To update a package, run the command yum update [PackageName] on your
command line

You will probably have this result when you run the yum update command. That’s because there is no package marked for an update, but this is the command for updating your package if any is marked for update

HOW TO INSTALL GROUP OF SOFTWARE WITH YUM COMMAND

On RedHat-based systems, there exist two main groups of software- The environmental groups and regular groups. These groups hold software which a related and which can be installed together for a specific purpose.

The environmental groups encapsulate other groups which have their own packages.
A package can be installed by default if the group member is installed, but installing a package will not necessarily install the group member. The regular groups are a collection of packages which can be installed together.

Please note that this method of installing group software does not apply to Debian machines, but there is another method of going about that. This section focuses on Yum group software packages.

To get an overview of the group list run the command yum group list on the command line

Now let's install the environmental groups to get all the packages in that group
installed in the system.

CONCLUSION

It is best to understand how packages works and how they are installed, uninstalled and upgraded/updated in Linux systems. As a system administrator, It is vital to understand the kind of package you updating or upgrading to as most software released as an update may either slow down your server or have some significant effect on your server. For newbies, you most at a time have nothing to do with upgrading packages, but it is necessary you learn how to install packages because as you deepen your learning in Linux, most packages need to be installed to have a piece of practical knowledge on how they work

Author

Comments