Dec 04

Create your own yum repo in Centos/Redhat

Yum is a software installation manager for Redhat Linux and Related.

yum is a better tool than rpm.

Here, we will take the rpm packages as come with Redhat/Centos and then we will host those packages on our own Repo Server for yum. i.e. yum will use this Repo to find installers rather than going to the Internet.

Installing Yum Manager

First we have to install and configure ftp.

[if vsftpd is not already installed, use rpm -ivh vsftpd, you need to mount installer dvd and run rpm under Packages folder - or similar]

Check the status of vsftpd
systemctl status vsftpd
systemctl start vsftpd
systemctl enable vsftpd
cd /var/ftp/pub/
ls -la
df -h (see disks and default mounts)
mount /dev/sr0 /mnt/iso-installer
(mount DVD where the iso of the installer is kept. I was using VMWare Workstation Pro)

Copy installer rpms from .iso to our ftp server
cd /mnt/iso-installer/
ls -la
cd Packages/
cp -v * /var/ftp/pub/
ls -la

Create the Repo database
We have to create a database based on all these rpm files. This repo database will be queried by yum to find packages and dependencies to install.

rpm -ivh createrepo-0.9.9-26.el7.noarch.rpm (create repo is not installed by default)

createrepo .

Now configure local PC [workstation with our Yum Repo/server under ftp]. We need a file local.repo to point to our yum repo server

ls /etc/yum.repos.d/
cd /etc/yum.repos.d/
ls -la

[move existing repo files to old directory]
mkdir old
mv *.repo old/

ls -la
touch local.repo


[need to configure local.repo]
Try to check any of the existing .repo file and create based on that. A basic config might look like this


If you want to put hostname for your ftp server

vim /etc/hosts
systemctl start vsftpd
systemctl restart vsftpd
ping localhost
ping yumserver
vi /etc/yum.repos.d/local.repo
hostnamectl set-hostname yumserver
cat /etc/hosts
hostnamectl set-hostname yumserver

You might need to run, if you see yum does not work
yum clean
yum clean cache

cd /etc/yum.repos.d/
cat old/CentOS-Base.repo
vim local.repo

Let FTP work through Firewall
firewall-cmd --add-service=vsftpd --perm
firewall-cmd --add-service=ftp --perm
systemctl reload firewalld
systemctl start firewalld
systemctl enable firewalld
vi /etc/yum.repos.d/local.repo

Check if your yum server is working or not

yum repolist
yum install tree

yum repolist enabled
yum repolist all

Skip to toolbar