
Repositories can be defined as a box where your work tools are kept. It is a store for packages/applications/software that enhance your Linux experience. There are repositories you can access online, however, within your Linux OS DVD is a rich repository that you do not require internet access to use. This tutorial will work you through creating and accessing this offline local repository in Linux.
First off, you need to ensure the connection of iso file for your OS (only if you are working from a Virtual Machine, if not, skip this first step). On the Virtual Machine, right click on the Linux name you are using and then click on settings
Creating an offline local repository in Linux

When the settings dialogue box opens, highlight the CD/DVD(IDE) tab, then tick the Connected and Connect at Power on checkbox.

Browse to the location of the ISO file on your desktop. Click on the file to open it to the dialogue box, then click on OK at the bottom right of the dialogue box. In a short while, the icon for the OS should appear on the desktop. (Creating an offline local repository in Linux)

MOUNT THE ISO FILE – Now switch to the root account. Create a directory for the mount point using the mkdir command. I have chosen to create and call my mount point iso

Now mount the iso file to the newly created directory using the mount command
Mount –o loop /path-of-iso-fle /destination-path
(in case you are not certain, a df –h command will tell you the address of your iso file)

Furthermore, Create a directory for the old cached repository file
Use the mkdir command a new directory, I am going to call mine “oldrepo”. Thus, this directory will be a store for the old repository files; you do not need to delete them. (Perhaps, there will be a need for something in there someday, you never can tell). These store repository files in the /etc/yum.repos.d directory. Now move these files to the newly created repository using;
mv /etc/yum.repos.d/* /newly-created-directory

Create a repository configuration file in /etc/yum.repos.d
Use any text editor to create a new file that ends with a “.repo” extension in the /etc/yum.repos.d directory. (The repository file name must end with a “.repo” extension). Mine is called new.repo and the command will be;
vi /etc/yum.repos.d/RepositoryName.repo

In that file, include the following parameters

In creating an offline local repository in Linux, you need to clean the yum cache using the yum clean all command. You can also see the newly created repository by using the yum repolist all command

Now you can use the yum command to install your packages. The next two images are cuts from installing the httpd from the newly created repository


So, without access to the internet, you can have your offline repository and update packages whenever access to the internet is available. With the steps mentioned above, creating an offline local repository in Linux is made easy.