Thursday, 8 December 2016

Create yum local repository

Create the yum local repository 



yum local repository very useful when you are work in LAN (Local Area Network ) .

Requirements :-

Need to copy the Packages folder to where you are create the repository.

Configuration Steps :-

Mount the CD/DVD to linux server :

Syntacx : mount -t iso9660 -o loop  /dev/dvd or /dev/cdrom  /mnt/iso



1. Copy  /centos/6/os/x86_64/Packages/  to any local directory

#mkdir /home/yum
#cp  -r /centos/6/os/x86_64/Packages/   /home/yum

2.  Install the create repo package with rpm.


#cd /home/yum/Packages

When installing above package it's ask for some dependency packages and install that packages.

3. Create or edit the yum repository configuration file.

#cd  /etc/yum.repos.d/ 

Backup or move all repositories to another directory and create the new file with any name 'localrep.repo' and add the lines like below

#vi localrep.repo


[Centos]
name=Centos Repo
baseurl=file:///home/yum/Packages
enabled=1
gpgcheck=0

:wq!
save&quit


From above configuration file gpg disabled if you want to enable the gpg please add below steps it's not mandatory 

gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

4. Create the repository file

#createrepo  ///home/yum/Packages

After the successful creation list the yum repository it's shows like below

# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: repos.lax.quadranet.com
 * extras: mirror.compevo.com
 * updates: repos.dfw.quadranet.com
repo id                                                                    repo name                                                                             status
base                                                                       CentOS-6 - Base                                                                       6,696
extras                                                                     CentOS-6 - Extras                                                                        62
updates                                                                    CentOS-6 - Updates                                                                      686
repolist: 7,444


5. In LAN your installed in one server you can use that repository in all servers in that LAN by using the ftp service. Please follow the the below steps.

create the repo configuration file. Suppose you are created yum repository in one of local server 10.1.2.4 and you want to use that repository in another server in LAN 10.1.2.5 byusing ftp. Please modify the lines as below.

Note :- ftp server must be configured on 10.1.2.4 with directory ///home/yum/Packages

10.1.2.5

#vi remote.repo

[Centos]
name=Centos Repo
baseurl=ftp:10.1.2.4///home/yum/Packages
enabled=1
gpgcheck=0

:wq!
save&quit

No comments:

Post a Comment