In this article, I’ll show you how to create a local yum repository in RHEL8 with all the commands that are needed for this configuration.
In Redhat Linux ‘rpm’ command is used to install packages i.e software. We might face some difficulties while using ‘rpm’ command, and the best way to use is ‘yum’ command.
These commands are used to check whether any software is installed or not.
# rpm -q firefox
# rpm -q vlc
For uninstalling or erasing any software, we use-
# rpm -e firefox
Now, if we use ‘yum’ command for installing the firefox-
# yum install firefox
This command will not work if it is not configured in your system. If you want to install any software, you have to download and install it first. After installing the software we can use ‘rpm’ command. For getting the software, we use the DVD or iso file of Redhat Linux.
DVD contains some folders like Base o.s and app stream which contains many software or packages. You can install it by double-clicking on it. If you use ‘rpm’ command to install software, you’ll have to go to the folder where the software is located. But sometimes, you might have too many folders having much software. It is not necessary to go to any folder or file to install any software if we use the ‘yum’ command. It downloads software in just one click if it is configured in your system. If any software has many versions, in this case, it’ll install the latest version.
For example, if you want to install VLC media player. We’ve to go to DVD, then we’ll search in the folders for this software, and suppose you didn’t get the software. The VLC media player is open-source software, we can download it from google also, for a particular o.s.
After downloading, we’ll use the ‘rpm’ command to install it. If you try to install in this way, the installation will fail due to many reasons as –
- the version may not be supporting or
- software downloaded requires some more software i.e VLC depends upon some more software, and that particular software might be requiring some other software. You’ll need to download all this software, this issue is known as Dependency.
These issues can be solved easily by ‘yum’ command. When I ask yum to install VLC, it’ll search all locations internally and it’ll download all the software that is supported for your o.s. Yum is an automatic command that’ll download all the software that is required by VLC.
Yum Configuration
Here, I’ll show all the steps of how to configure the yum-
- First, go to the DVD. Base O.S consists of base software and app stream consist of data related to the server. We’ll go inside the folder and open the terminal by doing the right-click.
This command gives the location of software-
# pwd
2. Yum has its own configuration files which are stored in /etc/yum.repos.d/. To go inside this folder, we use the following command-
# cd /etc/yum.repos.d/
This contains the configuration file,
# ls
You will get list of files here. In this folder any file ending with .repo is considered as yum configuration file. We’ll go inside the folder and create a new file using command-
# gedit qwe.repo
You can give any name to the file. Here, I’ve named the file as ‘qwe.repo’.
- We’ll copy the location of the Base O.S and app stream folder, where we’ve software located in a text editor. So basically, it’s a path where the software is available. You can also put the URL from the internet.
Keyword ‘gpgcheck=0’ will disable signature checking. Assigning value 1 instead of 0 tells us that whatever software we are installing that is been signed by a particular company, if that particular company is right then only it will allow us to go ahead.
- For testing whether yum is configured or not, we use the command-
# yum repolist
This command gives us the status of the number of software the directories have, also tells us that yum is configured successfully.
Now, for installing any software you can use yum command. This will install that software located on your DVD.
DNF configuration
Despite having more maturity of yum command, it looks very heavy and breaks sometimes and does not give the right performance. We have DNF command in Redhat 8 which solves all the issues of yum, and support all the things that yum supports.
For installing any software, we have the same commands and setup as yum-
# dnf install firefox
We have some software available in the market like epel-release. By installing this, it automatically creates yum for us which already has information on the base URL. We have a command which downloads any file or software from provided URL –
# wget (URL of software)
You can use rpm command to install later. You can use dnf command for downloading and installing the software –
# dnf (URL of software)
Instead of using rpm command or wget command for manually downloading, dnf command alone will install and download both things for you.