Install and configure local YUM Server on CentOS 7 [Guide]

With YUM, one can install and update groups of computers without having to manually update each one using RPM.

In this tutorial, we will show you how to configure and use local yum repository besides the typical online repository. For those new to YUM, Yellowdog Updater, Modified (YUM) is a software package manager that manages the RPM-based Linux distributions.

With YUM, one can install and update groups of computers without having to manually update each one using RPM.

The biggest advantage of using a local YUM repository is to perform any type of package installation without the need of the internet connection. The packages are stored in the local repository.

Another added benefit is the speed of download. Since the packages are downloaded via a local network, the updates will happen at a lightning speed.

Setting up local YUM server on CentOS 7

Before we begin, the first thing to do is to disable SELinux firewall because we are working on the local environment.

Step 1 – Disable SELinux

Let’s first edit the configuration file and change “SELINUX=enforcing” to “SELINUX=disabled”

vi /etc/sysconfig/selinux

Stop firewall and disable on system boot.

systemctl stop firewalld
systemctl disable firewalld

Then reboot the system.


Step 2 – Mount CentOS 7 media

Mount the local media like DVD, USB stick etc that contains CentOS 7 / Oracle Linux 7 / RHEL 7 etc.

Here we used the CentOS 7 DVD and mount it. Here we mount DVD media to “/mnt” directory

mount -t iso9660 /dev/sr0 /mnt

Step 3 – Copy media content to the Server

Before copying media, we will create a folder inside the server root directory.

mkdir /localrepo

Now copy media to the created folder.

cp -rv /mnt/* /localrepo/

Copying Media
Copying Media

Step 4 – Configure the Local Repository

Take a backup of the repository folder.

cd /etc

Backup repository folder.

cp -r yum.repos.d yum.repos.d-bak

Delete all online repository files.

rm -rf yum.repos.d/*

Create locate repository file.

vim yum.repos.d/local.repo

Add the following line to the file for Centos 7.


Then save and exit the file. For your information, here is what each of the items means in the above command.

[centos7] – Name of the Section.
name = Name of the repository
baseurl = Location of the package
Enabled = Enable repository
gpgcheck= Enable secure installation
gpgkey = Location of the key
gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)

Now update the local repository.

createrepo /localrepo/

Create Repo
Create Repo

Now enable the local repository.

yum clean all

Yum Clean All
Yum Clean All

List repository

yum repolist all

Repo List
Repo List

Step 5 – Test Local Repository

Now you can run update command and check if the update is working or not.

 yum update

Here is my system showing the updates. You can type “y” to confirm installation.

Yum Update
Yum Update

Now we will install the “zip” package.

yum install zip

Install Zip Package
Install Zip Package

Enter “y” to continue installation. Then it will install the IP package.

Step 6 – Host RPM Packages

Generally, YUM server uses HTTP or FTP as the medium to transfer packages. Here we are going to HTTP.

Install Apache.

 yum install httpd

Check the status of Apache.

systemctl status httpd

If service is not started you can start it following command:

systemctl start httpd

Enable Apache on system boot.

chkconfig httpd on

Now we will configure apache with created Repository path:

Normally Apache document root is “/var/www/html” . Here we are going to change it to our repository path.

Open the configuration file.

vi /etc/httpd/conf/httpd.conf

Find “DocumentRoot” and change the path. Then change the “Directory” path too.

After that find “Options Indexes FollowSymLinks” and change it to “Options All Indexes FollowSymLinks”. The file should look like below:

Apache Config File
Apache Config File

Then remove the Apache welcome page.

rm -rf /etc/httpd/conf.d/welcome.conf

Check for Apache configuration syntax.

httpd -t

Now restart Apache.

systemctl restart httpd

Use Server IPS to browse Repository.


Repository Browse
Repository Browse

Step 6 – Configure the Client Machine Repository

Backup the current repository folder.

cp -r /etc/yum.repos.d /etc/yum.repos.d-bak

Remove all repository files.

rm -rf /etc/yum.repos.d/*

Now create a new repository file.

vi /etc/yum.repos.d/localrepo.repo

Add following line to file:

name=Centos7 Repository

Save and exit the file.

List the repository.

yum repolist

List Repos On Client Machine
List Repos On Client Machine

We can see our local repository listed here. Clean yum cache.

yum clean all

Now update repository.

yum update

Test local repository from the client machine. Now we will install “elinks” from our local repository.

Install From Local Repository Server
Install From Local Repository Server

If you want you can proceed with typing “y”. It means our local repository working fine

There you go, you have successfully configured the local YUM repository on CentOS.

Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.



Please enter your comment!
Please enter your name here




How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

The 10 Best Linux Server Distros For Home And Businesses

By the year 2020, it is estimated that there are close to 600 Linux distributions in the market. It includes both servers and Desktop versions; therefore, if you are looking for lightweight Linux distribution for your old PC or a reliable desktop version for employees in your organization, you may be overwhelmed with the number of choices for finding one for your use.

How to list the installed Packages on Ubuntu

It is only natural to start installing more and more software on your Ubuntu PC once you start using it. Similarly, it is also natural to lose track of the different packages that you have installed on your system. Eventually, you may be overwhelmed with the number of packages in your system and with the ones you hardly used.


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

5 ways to check if a Port is open on a remote Linux PC

There is an ample number of ways to check for any open ports on a remote Linux PC. Knowing open ports on a Linux machine helps system administrators to connect to the remote PC for troubleshooting system and cloud server issues.

5 Best Music Players for Linux

For sure, there will be Linux users out there who cannot live without music. If you're one of those people, you would know how important it is to have a good music player installed on your computer system. In this article, we present to you the five Best Music Players for Linux, which will hopefully be able to satisfy each of our readers' needs.

The 6 Best Download Managers for Fedora

It is a well-known fact that using download managers can help improve download speeds as compared to web browsers. Apart from the inbuilt download manager wget on Fedora, just as on any distribution that is based on GNU/Linux package, there are more options to explore.

10 top reasons to switch to Manjaro Linux

Manjaro is Linux distro based on Arch-Linux which follows a rolling release model. Is this distro good for you? Let's find out the main reasons for using Manjaro.