LAB: Set up a repository.

Share this link

To be able to deploy new VM, you need a repository.

Install the Apache package:

# yum groupinstall -y "Web server"

Create the directories for the CentOS distribution and the updates:

# cd /var/www/html
# mkdir centos updates conf

In the software requirements, it was specified to download the 2-DVD version of the CentOS6 distribution. It is now time to use them.
Copy the first DVD:

# mount -o loop CentOS-6.4-x86_64-bin-DVD1.iso /mnt
# cd /mnt
# tar cvf - . | (cd /var/www/html/centos; tar xvf -)
# cd /; umount /mnt

Copy the second DVD:

# mount -o loop CentOS-6.4-x86_64-bin-DVD2.iso /mnt
# cd /mnt
# tar cvf - . | (cd /var/www/html/centos; tar xvf -)
# cd /; umount /mnt

In order to create a new repository for the updates, install the createrepo package:

# yum install createrepo

Go into the directory where the repository configuration is:

# cd /etc/yum.repo.d

Create the local.repo file and type:

name=master - Base
name=master - Updates

Copy the local.repo file into the http directory to make it available to the new VM:

# cp local.repo /var/www/html/conf

Reset the directory for the updates:

# cd updates; createrepo .

Assign the SELinux attributes to the files:

# restorecon -R /var/www/html

Activate the Apache server at boot:

# chkconfig httpd on

Start the Apache server:

# service httpd start

Edit the /etc/sysconfig/iptables file and add the following line:

# iptable -A INPUT -p tcp -m state --state NEW -m tcp —dport 80 -j ACCEPT

Save the firewall configuration:

# server iptables restart

Clean up the yum configuration:

# yum clean all

Check the yum configuration:

# yum repolist

In addition, you can watch TheUrbanPenguin‘s videos about creating a local repository (6min) or creating a local mirror (11min).

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Leave a Reply

Be the First to Comment!

Notify of


RHCSA7: Task of the day

Allowed time: 5 minutes.
Create two users "tom" and "engine". "tom" has the UID/GID 3000 and "engine" the UID/GID 4000. "engine" doesn't have an interactive shell.

RHCE7: Task of the day

Allowed time: 10 minutes.
Change the SSH process configuration to only listen on the 443 port.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...