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:

[base2]
name=master - Base
baseurl=http://192.168.1.5/centos/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates2]
name=master - Updates
baseurl=http://192.168.1.5/updates/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

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)
Loading...

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create two new user accounts "steve" and "oliver".
Create a group "team". Create a directory "shared".
All files put into the "shared" directory by "steve" or "oliver" should belong to the "team" group and be only visible by them.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria and create a table named people with two columns respectively name varchar(20) and age int(10) unsigned.

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 ...

Recent Comments