How to create local YUM repository for offline use on RHEL7 for openstack.

Even though if one have valid redhat subscription it requires high speed internet to access them. While installing openstack queens version I faced this. I am new to openstack and was setting up 3 node cloud for my reference. Deployment was not as smooth as I was expecting. I had to scratch and re-install my VMs multiple time. Each scratch installation was followed by os update and openstack installation which consumes lot of internet data. 

Later I found out solution to this, in form of offline repository. Now all operation I can follow without internet.

Following are the steps  I have followed   :

1) Installed RHEL 7.5 and registered with developer subscription using internet.


[root@localhost ~]# yum repolist 

Loaded plugins: product-id, search-disabled-repos, subscription-manager
repo id                                               repo name                                                                           status
openstack-queens                           OpenStack Queens Repository                                               2,235
rdo-qemu-ev                                   RDO CentOS-7 - QEMU EV                                                   59
rhel-7-server-extras-rpms               Red Hat Enterprise Linux 7 Server - Extras (RPMs)               877
rhel-7-server-optional-rpms           Red Hat Enterprise Linux 7 Server - Optional (RPMs)            15,199
rhel-7-server-rh-common-rpms      Red Hat Enterprise Linux 7 Server - RH Common (RPMs)     233
rhel-7-server-rpms                          Red Hat Enterprise Linux 7 Server (RPMs)                              20,693
repolist: 39,296

2) Used reposync to sync all remote repository to local directory

     reposync  -n -l --repoid=<repo id> --download_path=<path to local directory>
     e.g 
     reposync -l --repoid=openstack-queens --download_path=./openstack

3) my *.repo file looked like below:


[root@RnD ~]# more /etc/yum.repos.d/local.repo
                          [os]
                          name=openstack
                          baseurl=file:///root/openstack-repo/openstack
                          gpgcheck=0
                          enabled=1

                        [root@RnD ~]#

Comments