How to create, configure and use YUM repository in RHEL/Cent OS 7.
Whenever you use a base Operating System(OS), you have to install some packages which are very similar to the applications you install in Windows. Once you have installed the packages in RHEL/Cent OS you need to configure it. In RHEL/Cent OS we create repository which is the warehouse of the packages. The packages used in Unix/Linux are also dependant to other packages too. So, if you make a YUM repository in RHEL/Cent OS it would be very easy for the packages to locate the dependency and picks the dependent packages from the repository. Another benefit of creating a local Yum repository is that while installing a package you don’t need to connect to internet and download the package. You can directly install the package locally.
[su_label type=”success”]Things to do[/su_label]
- Mount ISO
- Copy and install packages.
- Create and configure YUM at /etc/yum.repos.d/
You can even watch the Youtube video which I have create for better understanding in creating YUM repository. If you want to want watch more videos please subscribe to our channel.
[su_youtube url=”https://www.youtube.com/watch?v=tgteBrfbNqw” width=”740″ height=”600″ autoplay=”yes”]
In this video above, I have also created a FTP sharing so that YUM repository can be used by other nodes as well for installing packages. This saves time, we just need to configure YUM in RHEL/Cent OS node so that it can access my YUM server. I have also shared that in my next blog.
You need to mount the CDROM.
[root@localhost ~]# mount /dev/cdrom /mnt mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# cd /mnt/Packages/ [root@localhost Packages]# ls
Since I am making a Yum repository server, so that other nodes can also access the packages. I will be installing VSFTPD package. This will help me to install the packages to be shared on FTP.
[root@localhost Packages]# rpm -ivh vsftpd-3.0.2-9.el7.x86_64.rpm
When this is done, we need to create a packages directory in /var/ftp/pub/ directory and place the packages in that directory to be shared.
Create a Packages folder to be shared.
[root@localhost Packages]# mkdir -p /var/ftp/pub/packages
Now, we need to copy the packages. Make sure you are in the package directory, only then * would be working in the command
[root@localhost Packages]# cp -av * /var/ftp/pub/packages/
When the packages are copied we need to run few more packages to create our repository.
[root@localhost Packages]# cd /var/ftp/pub/packages/ [root@localhost packages]# rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm deltarpm-3.6-3.el7.x86_64.rpm python-deltarpm-3.6-3.el7.x86_64.rpm
Related Post: How to configure BIND for DNS server in RHEL/CentOS 7
Now, we need to run a command which can help the OS to point the mentioned packages.
[root@localhost packages]# createrepo -v /var/ftp/pub/packages/
[su_label type=”info”]Configure YUM repository[/su_label]
[root@localhost packages]# vim /etc/yum.repos.d/yum.repo [rhel7] name="Redhat Enterprise 7" baseurl=file:///var/ftp/pub/packages/ enabled=1 gpgcheck=0 :wq! [root@localhost packages]# yum clean all [root@localhost packages]# yum update [root@localhost packages]# yum install bind*
This was way you can create your YUM repository locally and in next article you can check how can you use the YUM repository in the network for other nodes.
Kindly share the articles if you like it and please let me know you feedback.
[symple_divider style=”solid” margin_top=”20px” margin_bottom=”20px”]
[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]