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 a Website Availability from the Linux Command Line
Viewed 6740 times since Mon, Feb 18, 2019
Securing /tmp and shm partitions
Viewed 3333 times since Fri, May 15, 2020
How to mount software RAID1 member using mdadm
Viewed 3117 times since Wed, Oct 3, 2018
RHEL: How to change a USER/GROUP UID/GID and all owned files
Viewed 22931 times since Sat, Jun 2, 2018
Netcat shell zabezpieczony hasłem
Viewed 2319 times since Thu, May 24, 2018
RHEL: iSCSI target/initiator configuration on RHEL7
Viewed 11276 times since Sat, Jun 2, 2018
bash mistakes This page is a compilation of common mistakes made by bash users. Each example is flawed in some way.
Viewed 9182 times since Sun, Dec 6, 2020
Managing temporary files with systemd-tmpfiles on Red Hat Enterprise Linux 7
Viewed 9721 times since Sun, Nov 22, 2020
How To Add Swap Space on Ubuntu 16.04
Viewed 2415 times since Fri, Jun 8, 2018
RHCS6: Mirror/unmirror a GFS2 volume
Viewed 5340 times since Sun, Jun 3, 2018