SINGLE POST

Article & News.

Creating a Local Repository in Oracle Linux 7.5 for RPM Installation(Oracle database Required RPM)

 

## Creating a Local Repository in Oracle Linux 7.5 for RPM Installation

Setting up a local repository in Oracle Linux 7.5 can significantly enhance the installation process of RPM packages, especially when working in environments with limited or no internet access. In this guide, I’ll walk you through the step-by-step process of creating a local repository using an ISO file.

### Prerequisites
Before we begin, ensure that you have the Oracle Linux 7.5 ISO file available on your local machine. You will need to copy this file to the server where you intend to set up the repository. For this guide, I’ve placed the ISO file at the following path: `/root/V975367-01.iso`.

 

Note : All the steps are performed using root user .

### Step 1: Create a Directory for the ISO Image

First, we need to create a directory where the ISO image will be mounted. Use the following command to create the directory:

#   mkdir -p /var/OSimage/OL7.5_x86_64
“`

### Step 2: Mount the ISO Image

Next, we’ll mount the ISO file to the directory we just created. This allows the system to access the contents of the ISO as if it were a physical disk.

mount -o loop,ro /root/V975367-01.iso /var/OSimage/OL7.5_x86_64
“`

#### Important: Persist the Mount Across Reboots
To ensure the ISO image is mounted automatically after a system reboot, you need to add an entry to the `/etc/fstab` file. Open the file with your preferred text editor and add the following line:

/root/V975367-01.iso /var/OSimage/OL7.5_x86_64 iso9660 loop,ro 0 0
“`

This step ensures the repository remains available even after the server restarts.

### Step 3: Disable Existing Yum Repositories

To avoid conflicts and ensure the system uses your newly created local repository, it’s important to disable all existing Yum repositories. This can be done with the following command:

yum-config-manager –disable \*
“`

### Step 4: Create a New Repository Configuration

Now that the existing repositories are disabled, we need to create a new repository file that points to our local ISO. Create a new file named `OL75.repo` in the `/etc/yum.repos.d/` directory and add the following configuration:

vi /etc/yum.repos.d/OL75.repo
“`

Add the following content to the file:

[OL75]
name=Oracle Linux 7.5 x86_64
baseurl=file:///var/OSimage/OL7.5_x86_64
gpgkey=file:///var/OSimage/OL7.5_x86_64/RPM-GPG-KEY
gpgcheck=1
enabled=1

“`

Ensure that the GPG key file specified in the `gpgkey` parameter exists at the path provided. This key is crucial for verifying the integrity of the packages.

### Step 5: Clean Yum Cache and Verify the Repository

With the repository configured, it’s important to clean the Yum cache to ensure it recognizes the new repository:

yum clean all
“`

You can then verify the repository with:

yum repolist
“`

You should see the following output, which confirms that the repository is active and ready for use:

repo id repo name status
OL75 Oracle Linux 7.5 x86_64 5,081
repolist: 5,081
“`

### Final Step: Test the Repository

To ensure everything is set up correctly, try installing a package from the repository. For example, you can install the Apache web server with the following command:

yum install httpd
“`

If the installation completes successfully, congratulations! You’ve successfully set up a local Yum repository on Oracle Linux 7.5.

This guide should help you quickly create and manage a local repository on Oracle Linux 7.5, making it easier to install RPMs without needing internet access. If you have any questions or run into issues, feel free to reach out!

Share this article :
Facebook
Twitter
LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *