Apache YUM repository configuration on Linux

In production environment it might not possible to provide internet to all systems due to company policy or to control internet bandwidth. Installing a package from internet it might be slow because of low internet bandwidth. To overcome this issue we can configure a local yum server and put all the stuffs in the yum repository. Whenever there is a need to install a package it can be installed from the local repository. It saves a lots of internet bandwidth and as well as time.

Topic

  • How to configire Apache YUM on Centos Linux?
  • How to configire Apache YUM repository on RHEL or Scientific Linux?
  • Yum Repository Configuration using Apache We server


Solution


YUM Prerequisite
  • Bare minimum install of Centos

YUM Server details

Server IP = 192.168.0.101
Host name = server.example.local
OS = CentOS 7.x

YUM Server Configuration

Here we configure the local yum server on Centos 7 operating system and will use client on both RHEL 6 and RHEL 7.

  • Install following package to configure yum server
   # yum install httpd

  • Download installation image and mount it in any directory and copy into /var/www/html directory.
# mkdir /tmp/test
# mount -t iso9660 -o loop CentOS-7-x86_64.iso /tmp/test

# mkdir /var/www/html/centos7
# cp -r /tmp/test/* /var/www/html/centos7

# umount /tmp/test
# mount -t iso9660 -o loop CentOS-6.10-x86_64.iso /tmp/test

# mkdir /var/www/html/centos6
# cp -r /tmp/test/* /var/www/html/centos6

  • Start and enable apache service and allow firewall rule
# systemctl start httpd
# systemctl enable httpd
# firewall-cmd --permanent --add-port=80/tcp
# firewall-cmd --reload


Client side YUM configuration

  • Take backup all the repo file in /etc/yum.repos.d and create new repo file for local yum configuration.
# cd /etc/yum.repos.d/
# mkdir bkp
# mv *.repo bkp/

  • Create a repo file in /etc/yum.repos.d for centos 7 operating system.
# vim local.repo
[LocalRepo]
name=Local yum server
baseurl=http://192.168.1.101/centos7/
enabled=1
gpgcheck=0

  • Create repo file in /etc/yum.repos.d for centos 6 operating system
# vim local.repo 
[LocalRepo]
name=Local yum server
baseurl=http://192.168.1.101/centos6/
enabled=1
gpgcheck=0


YUM Testing

# yum clean all
# yum update all
# yum info vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name        : vsftpd
Arch        : x86_64
Version     : 3.0.2
Release     : 25.el7
Size        : 353 k
Repo        : installed
From repo   : base
Summary     : Very Secure Ftp Daemon
URL         : https://security.appspot.com/vsftpd.html
License     : GPLv2 with exceptions
Description : vsftpd is a Very Secure FTP daemon. It was written completely from: scratch.

# yum install vsftpd


You May Also Like

avatar

About the Author: TekFik

TekFik is a technical blogging site helps techies and engineers to solve their day to day issues and also allows everyone to share knowledge and feedback. Please feel free to contact us at tekfik.rd@gmail.com if there is anything.

Leave a Reply

Your email address will not be published. Required fields are marked *