Creating YUM in Redhat makes the local installation of the packages much easy.

 

[symple_box color=”blue” fade_in=”false” float=”center” text_align=”left” width=””]
Things to do
[/symple_box]

  • Mount the CDROM
  • Copy packages and repodata directory locally.
  • Create a yum file.
  • Update the YUM list

How to create YUM repository in Redhat CentOS Linux 7_bashcodes

Mount the CDROM.

I am showing two ways to access CDROM, so kindly use accordingly.

[symple_box color=”gray” fade_in=”false” float=”center” text_align=”left” width=””]

[root@localhost /]# mount /dev/cdrom /mnt                    #mounting CDROM in /mnt directory

[root@localhost /]# ls /mnt                                                         #check the CDROM contents

[root@localhost repodata]# cd /run/media/cyril/RHEL-7.1\ Server.x86_64/           #accessing the CDROM directly

[/symple_box]

Create a new directory locally.

[symple_box color=”gray” fade_in=”false” float=”center” text_align=”left” width=””]

[root@localhost repodata]# mkdir /packages

[/symple_box]

Copy Packages and Repodata

[symple_box color=”gray” fade_in=”false” float=”center” text_align=”left” width=””]

[root@localhost repodata]# cp /run/media/cyril/RHEL-7.1\ Server.x86_64/Packages /packages   # copying the packages to the /packages directory(recommend in GUI with user login)

[root@localhost repodata]# cp -r /run/media/cyril/RHEL-7.1\ Server.x86_64/repodata/ /packages   #copying the repodata directory to /packages directory so that we don’t need to create repodata

[/symple_box]

Create YUM repo file.

[symple_box color=”gray” fade_in=”false” float=”center” text_align=”left” width=””]

[root@localhost /]# cd /etc/yum.repos.d/           #moving to yum.repos.d directory

[root@localhost yum.repos.d]# vim yum.repo   #creating the repo file

 

[rhel 7]

name=”redhat enterprise 7″

baseurl=file:///packages/

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[/symple_box]

You need to update your yum list

[symple_box color=”gray” fade_in=”false” float=”center” text_align=”left” width=””]

yum update                                       #will update the yum list

These two commands are not necessary but if it is not creating using the steps above then you need to run these commands.

 

rpm –ivh createrepo                                      #you don’t need to run this command but if the you are not able to create the yum file then you need to go the /packages(directory where you have copied the packages) and run this command

createrepo –v /packages                              # only after running (rpm –ivh createrepo)

[/symple_box]

[symple_divider style=”solid” margin_top=”20px” margin_bottom=”20px”]

[symple_box color=”gray” text_align=”left” width=”100%” float=”none”]

If you like the blog please follow us [icon name=”icon-facebook”] [icon name=”icon-twitter”] [icon name=”icon-google-plus-sign”]

[/symple_box]