LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > JockVSJock
User Name
Password

Notices


Rate this Entry

How To Setup Local Repo for RHEL7

Posted 07-15-2016 at 08:31 PM by JockVSJock
Updated 07-15-2016 at 08:34 PM by JockVSJock

Wanted to write up a quick HOWTO on how to setup a local repo in RHEL7. A local repo is a way for the server to install packages via YUM, if it doesn't have a access to install packages from either a Red Hat Satellite or Internet Access.

Again, there are a number of tutorials online that are either missing steps, aren't clear, or are not well explained. I wanted to writeup a step-by-step HOWTO that works with RHEL7, in a virtual environment, using Virtual Box as the Hypervisor.

This HOWTO assumes basic knowledge of Linux, VirtualBox, yum commands, and RHEL The user must be logged in as Root user. Remember to use this HOWTO at your own risk. Backup all data first before proceeding.


The first step is to have an active RHEL7 server running in Virtual Box. Once we have that, lets mount an RHEL7 install disk from Storage and type the following command to confirm it is mounted.

Code:
mount
Once this is done, lets create a repo under /tmp. We can create a repo anywhere on the local server, as long as we have enough space.

Code:
mkdir -p /tmp/local_repo
Once that directory is created, let's move into the mounted install disk and locate the Packages directory. Once we do that, copy everything down to /tmp/local_repo with the following command:

Code:
cp -R * /tmp/local_repo
Once that is complete, change into the /tmp/local_repo and run the following command using rpm to create the local repository.

Code:
rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm
We also need to import the RPM-GPG-KEY by using the following command:

Code:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Once that is complete, change into the following directory and create a local.repo file.

Code:
cd /etc/yum.repos.d 

touch local.repo ; vim local.repo
Edit local.repo to look like this:

Code:
[local_repo]
name=Local Repo 
baseurl=file:///tmp/local_rep
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Once you save that file, then run the following commands to confirm that all is ok:

Code:
yum clean all ; yum repolist
If it comes back with no errors, you are ready to go. To test, install the star packages via yum with the following command:

Code:
yum install -y star
Posted in RHEL
Views 5579 Comments 0
« Prev     Main     Next »

  



All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration