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
Using etckeeper with git
Viewed 6995 times since Sun, Jun 3, 2018
RHEL: udev rules basics
Viewed 9020 times since Sat, Jun 2, 2018
Increase A VMware Disk Size (VMDK) Formatted As Linux LVM without rebooting
Viewed 15554 times since Wed, May 30, 2018
CentOS / RHEL : How to move a Volume Group from one system to another
Viewed 3711 times since Mon, Jan 28, 2019
Linux RedHat How To Create An RPM Package
Viewed 3354 times since Sun, Jan 9, 2022
ubuntu How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux
Viewed 8358 times since Tue, Dec 8, 2020
Linux Add a Swap File – HowTo
Viewed 10252 times since Fri, Jun 8, 2018
Linux - How to unlock and reset user’s account
Viewed 4706 times since Fri, Jun 8, 2018
RHEL: XFS basic operations
Viewed 16141 times since Sat, Jun 2, 2018
stunnel: Authentication
Viewed 9241 times since Fri, Sep 28, 2018