CentOS

How to configure CentOS Local Yum Repository

Share on Social Media

In this tutorial, you will learn, how to configure CentOS Local Yum Repository. #centlinux #linux #yum

Problem Statement:

In RPM based Linux distros, sometimes it is getting very difficult to resolve dependencies especially if it exist in a chain manner. This is where the yum comes into play, but it requires a repository to connect and download the packages. If server has access to the Internet, then it is very easy to connect to public repositories on the Internet. However, private networks servers usually do not have access to the Internet. For such environment, we are required to setup a yum repository for easy and fast installation of packages.

Read Also: How to setup Local Yum Repository in CentOS 7

Configure Local Yum Repository in CentOS 6:

Login to the Server that you want to setup as the Local Yum Repository Server.

Mount the CDROM and copy packages folder from cdrom to a local folder /var/ftp/pub/yum_repo.

mkdir –p /work/cdrom
mount /dev/cdom /work/cdrom
mkdir –p /var/ftp/pub/yum_repo
cp /work/cdrom/Packages/* /var/ftp/pub/yum_repo
umount /dev/cdrom

Install create-repo package (including dependencies) from the yum_repo folder.

cd /var/ftp/pub/yum_repo
rpm –Uvh create-repo*
Local Yum Repo 1

Go to the local yum folder and create repository.

cd /var/ftp/pub/yum_repo
createrepo .
Local Yum Repo 2
Local Yum Repo 3
Local Yum Repo 4

Once the repository created successfully, add it to the server yum repo profile as /etc/yum.repos.d/rhel_local.repo.

vi /etc/yum.repos.d/rhel_local.repo
Local Yum Repo 5

Test configuration by query the yum repolist.

Local Yum Repo 6

At this point the Local yum repository is successfully configured for the local server. However, our objective is to make it accessible by all the servers on the network, therefore we required to setup FTP services on this server.

yum install vsftpd
chkconfig vsftpd on
service vsftp start

Set necessary configurations for vsftpd.

vi /etc/vsftpd/vsftpd.conf

and set following parameter.

Local Yum Repo 7

Save the configuration file and restart the vsftpd service.

service vsftpd restart

Allow FTP port in Firewall.

system-config-firewall-tui
Local Yum Repo 8

Select the service ftp and press space key to enable it.

Local Yum Repo 9

Press Close to return to main screen.

Local Yum Repo 10

Press Ok.

Local Yum Repo 11

Press Yes to confirm apply the changes.

To check that ftp service is accessible, browse the server from another machine browser.

Local Yum Repo 12

Now, update the baseurl in rhel_local to use the ftp protocol.

vi /etc/yum.repos.d/rhel_local.repo
Local Yum Repo 13
yum repolist
Local Yum Repo 14

Now, the Local Yum Repository has been configured for your network. Just copy the rhel_local.repo file to /etc/yum.repos.d/ to all servers on your network to use it.

Furthermore, we use CentOS 6.5 to demonstrate the configuration. However, the configuration is quite similar in other Linux distros.

Conclusion – CentOS Local Yum Repository:

In this tutorial, you have learned, how to configure CentOS Local Yum Repository.

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

Share
Published by
Alaric Bird

Recent Posts

Puppy Linux: Fast and Simple OS

Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…

1 day ago

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

4 weeks ago

This website uses cookies.