FTP 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 configure FTP YUM on Centos Linux?
  • How to configure FTP YUM repository on RHEL or Scientific Linux?
  • FTP YUM repository configuration on Linux


Solution


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 will 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 vsftpd

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

# mkdir /var/ftp/pub/centos7
# cp -r /tmp/test/* /var/ftp/pub/centos7

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

# mkdir /var/ftp/pub/centos6
# cp -r /tmp/test/* /var/ftp/pub/centos6

  • Edit vsftpd configuration file and make the following changes
# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
idle_session_timeout=600
data_connection_timeout=120

  • Start and enable ftp service and allow firewall rule
 # systemctl start vsftpd
# systemctl enable vsftpd
# firewall-cmd --add-service=ftp --permanent
# firewall-cmd --reload


YUM Client side 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 repo file in /etc/yum.repos.d for centos 7 operating system
# vim local.repo
[LocalRepo]
name=Local yum server
baseurl=ftp://192.168.1.101/pub/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=ftp://192.168.1.101/pub/centos6/
enabled=1
gpgcheck=0


YUM Testing

# yum clean all

# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Name        : httpd
Arch        : x86_64
Version     : 2.4.6
Release     : 89.el7.centos
Size        : 9.4 M
Repo        : installed
From repo   : updates
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

# yum install httpd


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 *