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

[huupv@huupv huuphan.com]$ sudo mkdir -p /mnt/dvd

If you used a physical DVD

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

If you used an IOS file

[huupv@huupv 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.

[huupv@huupv 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.

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

Comments

Popular posts from this blog

How to Install Python 3.13

Best Linux Distros for AI in 2025

How to Play Minecraft Bedrock Edition on Linux: A Comprehensive Guide for Tech Professionals