Tuesday, November 19, 2013

How to create local repository in Redhat/Centos/Fedora

After doing installation, especially in fedora family, RHEL, etc. We can do installation if we didn’t do update repositroy.
There are a few way to add repository.
This time we will disccuss how to create local repository using dvd installation.
First input CD/DVD installation
Input user root with command su – and input password.
create directory to save the repository. example /repo create with command mkdir/repo
mount CD/DVD from /media
- mount CD /DVD from /media/”nama directory with command:
mount -o loop /media/”namafolderdirektorydvd” /repo
or we can copy entiry disk into a new folder under /repo
cp -rf /media/"namafolderdirektorydvd"/* /repo/

- after remout  or copy, we can make file repo first in directory /etc/yum.repos.d/
- create file wih ekstensi .repo example lokal.repo with command:
vim lokal.repo.
below is the format file:
by default using
[name title]
to basic format, below is the explanation.
for title name = you can input whatever you want
for name= you can input whatever you want
to baseurl, you can diisi using 3 format:
1. using path ftp
example ftp://instructor.example.com/pub/
2. using http
example http://instructor.example.com/pub/
3. using file
example file:///var/log/
to enabled, it an be input with value 1 or 0.
1 for enabled
0 for disabled.
if enabled being input with value 0 then repository will not being used.
for gpgcheck, this part can be input with value 1 or 0. if in file repository, this part is input with value 0 if we want to use local repository.
gpgcheck is being used if we want to update with RHN.
in this case we can input value in baseurl section with format file:///repo because we already mount the repository file in /repo.
for example (please see in below picture)

If you remount entire disk in /repo, you can skip below line and go to update using command yum update. 
but if you copy entire disk. first of all, you must install first the createrepo first.
below is the command to install create repo
go to folder /repo/Server/
use command
rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm  deltarpm-3.5-0.5.20090913git.el6.i686.rpm python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
after u install the createrepo.
use command 
createrepo -v /repo
wait until the process finish
after that do update using command:
#yum update
to check if the repository is already active or not, we can use command
#yum repolist
after that the local repository that we create is already working.


Post a Comment