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
Red Hat 8 How to Set Up Automatic Updates for CentOS 8
Viewed 3461 times since Fri, Sep 25, 2020
CentOS / RHEL 7 : Configuring an NFS server and NFS client Linux NFS
Viewed 16115 times since Fri, Feb 21, 2020
Stunnel Setup
Viewed 17514 times since Fri, Sep 28, 2018
How to disable SSH cipher/ MAC algorithms for Linux and Unix
Viewed 44736 times since Fri, Aug 21, 2020
Moving SSL Certificate from IIS to Apache
Viewed 1774 times since Mon, Feb 18, 2019
Top 20 OpenSSH Server Best Security Practices ssh linux aix
Viewed 5690 times since Fri, May 15, 2020
How to mount software RAID1 member using mdadm
Viewed 2881 times since Wed, Oct 3, 2018
Understanding logrotate utility part 1
Viewed 1569 times since Fri, Nov 30, 2018
Script to Offline and Remove A Disk In Linux
Viewed 1802 times since Mon, Jan 28, 2019
Linux - How to monitor memory usage
Viewed 2864 times since Fri, Jun 8, 2018