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
RHEL: Rename a network interface on RHEL 7
Viewed 12317 times since Sat, Jun 2, 2018
Terminal based "The Matrix" like implementation
Viewed 4900 times since Thu, Apr 18, 2019
LVM: Mount LVM Partition(s) in Rescue Mode
Viewed 6541 times since Sat, Jun 2, 2018
Use Fail2ban to Secure Your Server
Viewed 16817 times since Fri, Jul 5, 2019
LVM: Extend an existing Volume Group by adding a new disk
Viewed 2902 times since Sat, Jun 2, 2018
RHEL: Crash kernel dumps configuration and analysis on RHEL 5
Viewed 9149 times since Sat, Jun 2, 2018
10 nmap Commands Every Sysadmin Should Know
Viewed 11490 times since Wed, May 22, 2019
LVM: Recovering Physical Volume Metadata
Viewed 14354 times since Sat, Jun 2, 2018
Secure Remote Logging to Central Log Server Using RSYSLOG on CentOS 6 / CentOS 7 and stunnel
Viewed 5569 times since Sun, Dec 6, 2020
python learning
Viewed 2782 times since Wed, Dec 18, 2019