How to create a local yum repository for Centos/Redhat/Fedora

In this tutorial, How to create a local yum repository for Centos/Redhat/Fedora.

Step 1: mount your ISO file

Create folder path /mnt/dvd

[[email protected] huuphan.com]$ sudo mkdir -p /mnt/dvd

If you used a physical DVD

[[email protected] huuphan.com]$ sudo umount /dev/sr0
[[email protected] huuphan.com]$ sudo mount -t iso9660 -o ro /dev/sr0 /mnt/dvd

If you used an IOS file

[[email protected] huuphan.com]$ sudo mount -t iso9660 -o loop,ro /opt/CentOS-7-x86_64-Minimal-1511.iso /mnt/dvd

Step 2: Create the repository

I'll use vi editor.

[[email protected] huuphan.com]$  vi /etc/yum.repos.d/local.repo

Add the following lines:

[local]
name=Local DVD or ISO repository
baseurl=file:///mnt/dvd
gpgcheck=0
enabled=1

Step 3: Test your local repository

I installing nginx package using local repository.

[[email protected] huuphan.com]$  yum install --disablerepo="*" --enablerepo="local" nginx
How to create a local yum repository for Centos

No comments:

Post a Comment