Monday, 27 July 2015

REDHAT 7: How to create a local yum repo server

Inorder to create a local yum repo server follow the steps below.

STEP 1: Copy the iso image to a location in which you are going to create an yum repo.

STEP 2: Mount the iso image, using the below command:
mount -o loop rhel-server-7.0-x86_64-dvd.iso /mnt

STEP 3: Install the following packages in the server.
rpm -ivh /mnt/Packages/vsftpd-*.rpm
rpm -ivh /mnt/Packages/deltarpm-*.rpm
rpm -ivh /mnt/Packages/python-deltarpm-*.rpm
rpm -ivh /mnt/Packages/createrepo-*.rpm

STEP 4: Start vsftpd service using below command:

systemctl start vsftpd.service ---> To start service
systemctl enable vsftpd.service---> To enable on start up.
systemctl is-enabled vsftpd.service---> To check whether the service is enabled.

STEP 5: Copy installation tree.

mkdir -p /var/ftp/pub/rhel7
cp -rp /mnt/* /var/ftp/pub/rhel7/
cd /var/ftp/pub/rhel7

STEP 6:  Create repository using "createrepo" command.

createrepo -g repodata/*-comps-Server.x86_64.xml .

The above output result shows that, yum has been created successfully.

STEP 7:  Create a repo file as "/etc/yum.repos.d/rhel70.repo"

The file looks as below:

[root@SERVER]#cat  /etc/yum.repos.d/rhel70.repo
name=RHEL 7.0

In which, "" is the ip address of my local machine.

STEP 8: Use the below commands to clean repository and list the available packages.
yum clean all
yum repolist

Kool :)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.