SYS: Configure a local repository. local repo

SYS: Configure a local repository.

Share this link

 

Create a directory where packages will be stored:

# mkdir /repo

Two options: mount the distribution DVD or copy it into /repo.
To mount the DVD, edit the /etc/fstab file and add the following line:

/dev/cdrom /repo iso9660 loop 0 0

Then, mount the DVD:

# mount -a

To copy the DVD, type:

# mount -o loop /dev/cdrom /mnt
# cd /mnt
# tar cvf - . | (cd /repo; tar xvf -)
# cd /; umount /mnt

Optionally, update the repository structure (if new packages have been added):

# yum install -y createrepo
# createrepo /repo

Create the /etc/yum.repos.d/local.repo file and add the following lines:

[repo]
name=Repo - Base
Baseurl=file:///repo
enabled=1

Note: If you don’t remember the syntax, read the yum.conf man page.

Clean up the yum cache:

# yum clean all

Additional Resources

RedHat provides an video about Creating a Local Repository and Sharing With Offline Systems (8min, 2018).

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Check Detailed CPU Information In Linux With CoreFreq [Advanced]
Viewed 2028 times since Thu, Apr 18, 2019
Install Security Patches or Updates Automatically on CentOS and RHEL
Viewed 1507 times since Fri, Oct 26, 2018
RHEL: iSCSI target/initiator configuration on RHEL6
Viewed 8368 times since Sat, Jun 2, 2018
Linux PAM configuration that allows or deny login via the sshd server
Viewed 1595 times since Wed, Oct 3, 2018
How to stop and disable auditd on RHEL 7
Viewed 38378 times since Tue, Aug 6, 2019
How to sort IP addresses in Linux
Viewed 3254 times since Sun, May 20, 2018
How to automate SSH login with password? ssh autologin
Viewed 2389 times since Fri, Jun 8, 2018
Find All Large Files On A Linux System
Viewed 1860 times since Mon, Oct 29, 2018
high swap space utilization in LINUX
Viewed 6306 times since Fri, Jul 13, 2018
Terminal based "The Matrix" like implementation
Viewed 1915 times since Thu, Apr 18, 2019