GNU/Linux Bash Command Lessons – 6 – Package Management

Hi, we continue to Linux articles in this article we will look at package management and package & program installation.

 

Package Management :

If we use the Linux operating system as Desktop or Server, we do this through the terminal when we install a program or package.

This may be due to faster opening of the terminal and running the command. Since the machines we use as servers do not have a specific GUI, we have to do this from the terminal.

However, if our Linux operating system is used as desktop, we can download the application by searching through our web browser and finding the appropriate linux version. In this article, we will perform our operation over the terminal while installing our applications.

The Linux operating system has different distros, such as Red Hat, Ubuntu, Linux Mint, Oracle Linux, etc.

Although these operating systems basically use linux kernels, they are different from each other with their specific features, but we will look at the topic before we go into this topic in depth.

There are multiple installation tools for installing packages & programs on Linux operating systems. Each version has ready-to-install package installation commands.

 

For example, rpm comes with Red Hat ready. Available in versions like Ubuntu, Mint, apt. Oracle comes with linux, yum.

These bundled installers come ready when the operating system is installed, but we can install another bundled installer and download from it.

Let’s try a small example and try to understand the big picture.

Suppose we want to download mysql-server to our operating system and try to do this via the terminal.

I’m currently using yum (Yellowdog Updater Modified) command because I’m doing my examples on Oracle linux.

This command has more than one parameter and usage, but most basically when we want to make an installation, yum install package_name

yum install mysql-server

Waiting for y or n commands. Let’s download it or not!

Now what matters is how this system works rather than the applications we have downloaded. Because we may not always be able to download what we want to download so quickly.

So this is how mysql-server or filezilla, Chrome etc are dowloading these programs.

The yum package manager installs its configuration file and a repository directory under / etc when the operating system is installed.

The configuration file actually points to the repo directory. What does the repo directory do?

Let’s go from bottom to top, we

yum install mysql-server. package manager first looked at these addresses,

public_ol6_uekr4

public_ol6_addons

public_ol6_latest

It was then prepared to begin downloading without searching for more repos.

The mysql-server package and the required packages to be installed are in the public_ol6_latest repo.

So you will benefit from this repo yum while doing this download. Where’s the repo?
Let’s go to / etc and type cd yum and press Tab twice quickly.
We have 3 files related to yum under / etc. First, let’s examine the yum.conf file.

cat /etc/yum.conf

When we look inside the file, there are various configurations and given parameters.

However, what is important for now is

#PUT YOUR REPOS HERE OR IN separate files named file.repo

#in /etc/yum.repos.d

If we create our own repos and put them in this file and make the necessary configurations, the programs we will download start to use this repo.

Let’s see what’s in this file.

cd /etc/yum.repos.d
cat  public-yum-ol6.repo

As you can see in the picture, we do your downloads using Oracle’s repos. If you remember you had just told us the address of the repo when downloading mysql-server.

public_ol6_latest

Let’s copy the URL of this repo and paste it into our web browser.

http://yum.oracle.com/repo/OracleLinux/OL6/latest/

Oracle has made two different directories according to the operating system version. Let’s look at the x86.

When I come to the letter m alphabetically, we see that there are many packages, programs etc. related to mysql.

When we run the yum install mysql-server command, the package manager first goes from the config file to the repo directory and then starts searching for mysql-server-related files at the specified url addresses (server) in the repo directory, asking for permission to download.
That’s all !
In this example, I used the yum package manager, but a different package manager works with the same layout.
If we want to create a repo ourselves and repoda the URL (Server domain), we want to install packages and programs, then we can download from our own server.

You can read following article to learn other GNU/Linux bash command tutorials.

GNU/Linux Bash Commands Tutorial for Beginners -6 Network Commands

 

  

Do you want to learn Linux System Administration for Beginners, then read the following articles.

https://ittutorial.org/linux-administration-tutorial-for-beginners/

About Deniz Parlak

Hi, i’m Security Data Scientist & Data Engineer at My Security Analytics. I have experienced Advance Python, Machine Learning and Big Data tools. Also i worked Oracle Database Administration, Migration and upgrade projects. For your questions [email protected]

Leave a Reply

Your email address will not be published. Required fields are marked *