RSS

How to create central YUM Repository server on CentOS step by step

22 Aug

How to create central YUM Repository server on CentOS

Step 1. To Install Createrepo on server

[root@repo ~]# yum -y install httpd xinetd syslinux vsftpd dhcp

Complete!

Step 2. To Create repository directory and add packages on directory

[root@repo ~]# mkdir /repos/CentOS/6.8/ -p

[root@repo ~]# createrepo –update /repos/CentOS/6.8/
Could not find valid repo at: /repos/CentOS/6.8/

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

Step 3. To Mirror using Local ISO

[root@repo /]# mount -o loop /media/sr0/ /mnt/
[root@repo /]# cp -arv /mnt/* /repos/CentOS/6.8/

Step 4. To Mirror using Online Repository

[root@repo /]# rsync -rz –progress rsync://download.nus.edu.sg/centos/6.8/

Step 5. To publish our local repository via apache

[root@repo /]# yum install httpd

[root@repo /]# ln -s /repos/CentOS/ /var/www/html/CentOS

[root@repo ]# /etc/init.d/httpd start
Starting httpd: [ OK ]

Step 6. If you need File sharing using FTP

[root@repo /]# yum install vsftpd

[root@repo /]# ln -s /repos/CentOS/ /var/ftp/pub/CentOS_ftp

[root@email CentOS]# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]

Step 7. To create local.repo on client systems

cd /etc/yum.repo.d/

vi local.repo

Add as follow:

[mylocalrepo]
name=Local CentOS Repo
baseurl=http://my-repo-server/CentOS/6.8
gpgcheck=0

 
Leave a comment

Posted by on August 22, 2017 in Documents, Linux

 

Leave a comment