You are on page 1of 5

2/28/2015 RHEL7: Set up a local repository for a lab.

 ­ CertDepot

CertDepot
Everything you need to pass your RHCSA, RHCE, LFCS, LFCE & VCP exams.

search here …   Go

Home About RHEL6 RHEL7 VCP5­DCV

RHEL7: Set up a local  Upcoming

repository for a lab. Events

MAR 6:00 pm ­
Last updated on November 30, 2014 (1,489 views) — No Comments ↓ 6 View
Details 
Fri
vanVugt:
Share this link Free
online
class on
SELinux
issues

To be able to quickly deploy new VMs, you need a local MAR 6:00 pm ­


repository. 13 View
Details 
Fri
vanVugt:
Install the Apache package: Free
online
class on
# yum group install ‐y "Basic Web Server" NFS­
Kerberos

Create the directories for the CentOS distribution and the
6:00 pm ­ MAR
updates:
20 View
Fri Details 
vanVugt:
# cd /var/www/html Free
# mkdir ‐p conf repo/CentOS/7 online
# cd repo/CentOS/7 class on
ACLs
# mkdir ‐p centosplus/x86_64 extras/x86_64 os/x86_64 updates/x86_64

In the software requirements, it was specified to download the
DVD version or the Everything version of the CentOS 7
http://www.certdepot.net/rhel7­set­local­repository­lab/ 1/7
2/28/2015 RHEL7: Set up a local repository for a lab. ­ CertDepot

distribution. It is now time to use it. APR 6:00 pm ­


3 View
Details 
Mount the previously downloaded iso and copy it into the right Fri
place: vanVugt:
Free
online
# mount ‐o loop CentOS‐7.0‐1406‐x86_64‐DVD.iso /mnt class on
Apache
# cd /mnt
# tar cvf ‐ . | (cd /var/www/html/repo/CentOS/7/os/x86_64; tar xvf ‐)
APR 6:00 pm ­ View
# cd /; umount /mnt Details  10 vanVugt: Free
Fri
online class on
troubleshooting
In order to prepare the centosplus, extras and updates
repositories, install the createrepo package:
APR 6:00 pm ­
15 View
Wed Details 
# yum install createrepo
vanVugt:
Free
Prepare the centosplus, extras and updates repositories: online
class on
iSCSI
# cd /var/www/html/repo/CentOS/7/centosplus/x86_64; createrepo .
APR 6:00 pm ­
# cd ../../extras/x86_64; createrepo .
# cd ../../updates/x86_64; createrepo . 24 View
Details 
Fri
vanVugt:
Free
online
Go into the directory where the repository configuration is:
class on
remote
# cd /etc/yum.repos.d logins

Create the local.repo file and paste the following lines:

[os] RHCSA6:
name=master ‐ Base Task of the
baseurl=http://192.168.1.5/repo/CentOS/$releasever/os/$basearch/ day
gpgcheck=1
gpgkey=file:///etc/pki/rpm‐gpg/RPM‐GPG‐KEY‐CentOS‐7 Allowed time: 10
minutes. 
[updates] Set up a default
name=master ‐ Updates configuration HTTP
server with SELinux in
baseurl=http://192.168.1.5/repo/CentOS/$releasever/updates/$basearch/
gpgcheck=1 Enforcing mode and
gpgkey=file:///etc/pki/rpm‐gpg/RPM‐GPG‐KEY‐CentOS‐7 active iptables.

http://www.certdepot.net/rhel7­set­local­repository­lab/ 2/7
2/28/2015 RHEL7: Set up a local repository for a lab. ­ CertDepot

[extras]
name=master ‐ Extras
baseurl=http://192.168.1.5/repo/CentOS/$releasever/extras/$basearch/
RHCE6: Task
gpgcheck=1 of the day
gpgkey=file:///etc/pki/rpm‐gpg/RPM‐GPG‐KEY‐CentOS‐7
Allowed time: 15
minutes. 
[centosplus]
Set up a httpd virtual
name=master ‐ CentosPlus
server called "dummy"
baseurl=http://192.168.1.5/repo/CentOS/$releasever/centosplus/$basearch/
with DocumentRoot
gpgcheck=1
assigned to /opt.
gpgkey=file:///etc/pki/rpm‐gpg/RPM‐GPG‐KEY‐CentOS‐7

Note: A yum update command will update the system with
what the local Apache server’s got.
Twitter
Tweets Follow
Copy the local.repo file into the /var/www/html/conf directory
to make it available to the new VMs: Jastis4Ever 6h
@Jastis4Ever
How to Configure tigervnc
# cp local.repo /var/www/html/conf server on Centos 7: How
to Configure tigervnc
server on Centos 7
Assign the SELinux attributes to the files: bit.ly/1BLEAfI
Retweeted by
CertDepot
# restorecon ‐R /var/www/html
Expand
Tweet to @CertDepot
Activate the Apache server at boot and start it:

# systemctl enable httpd && systemctl start httpd

Recently
Add the Apache service to the firewall configuration:
Updated
Pages
# firewall‐cmd ‐‐permanent ‐‐add‐service=http RHEL7 Free
success available
resources

Reload the firewall configuration: RHEL7: Use yum
transaction
history.
# firewall‐cmd ‐‐reload RHEL7: Install

http://www.certdepot.net/rhel7­set­local­repository­lab/ 3/7
2/28/2015 RHEL7: Set up a local repository for a lab. ­ CertDepot

success Red Hat
Enterprise Linux
systems as
Clean up the yum configuration:
virtual guests.
RHEL7 RHCSA
# yum clean all Exam objectives
RHEL7: Update
Check the yum configuration: the kernel
package
appropriately to
# yum repolist all
ensure a
Loaded plugins: fastestmirror, langpacks
bootable system.
centosplus                                            | 2.9 kB     00:00
RHEL7: Locate,
extras                                                | 2.9 kB     00:00
read, and use
os                                                    | 3.6 kB     00:00
system
updates                                               | 2.9 kB     00:00
documentation
(1/2): os/7/x86_64/group_gz                             | 157 kB   00:00
including man,
(2/2): os/7/x86_64/primary_db                           | 4.9 MB   00:00
info, and files in
Loading mirror speeds from cached hostfile
/usr/share/doc.
repo id                        repo name                       status
RHEL7: How to
centosplus/7/x86_64            master ‐ CentosPlus             enabled:     0
deal with HTTPD
extras/7/x86_64                master ‐ Extras                 enabled:     0
SELinux policy.
os/7/x86_64                    master ‐ Base                   enabled: 8,465
SELINUX: Use
updates/7/x86_64               master ‐ Updates                enabled:     0
boolean settings
repolist: 8,465
to modify system
SELinux settings.
SELINUX:
Finally, you need an extra step to regularly update your lab local Diagnose and
repository. address routine
Create a Bash script called /root/rsync.sh and paste the SELinux policy
following lines (where mirror.ovh.net/ftp.centos.org/7/ is the violations.
url of a close CentOS repository): RHEL7: How to
install a Nginx &
#!/bin/bash PHP service.
/usr/bin/rsync ‐av ‐‐delete ‐‐delete‐excluded ‐‐exclude "local" ‐‐exclude "isos" ‐‐exclu

Give the execution permissions:
Recent
# chmod u+x /root/rsync.sh
Comments
mfsid on RHEL6
Put this script into the root crontab (# crontab ­e): LFCS Exam

http://www.certdepot.net/rhel7­set­local­repository­lab/ 4/7
2/28/2015 RHEL7: Set up a local repository for a lab. ­ CertDepot

objectives
00 02 * * * /root/rsync.sh
CertDepot on
Final call for
Note: The first synchronization will last a while but, after, it will RHCSA 6 &
be quick. RHCE 6 exams.
konrad on Final
After synchronization, you will get this kind of result: call for RHCSA 6
& RHCE 6
# yum repolist all exams.
Loaded plugins: fastestmirror, langpacks CertDepot on
Loading mirror speeds from cached hostfile Website news.
CertDepot on
repo id                          repo name                        status
RHEL7 RHCSA
centosplus/7/x86_64              master ‐ CentosPlus              enabled:    70
Exam objectives
extras/7/x86_64                  master ‐ Extras                  enabled:    44
os/7/x86_64                      master ‐ Base                    enabled: 8,465
updates/7/x86_64                 master ‐ Updates                 enabled:   866
repolist: 9,445

Poll for
favorite
book
Leave a Reply
You must be logged in to post a comment. What is your favorite
book to prepare
RHCSA & RHCE
exams?

 Damian
Tommasino’s
book
 Michael Jang’s
book
 Asghar Ghori’s
book
 Others
 None

Vote

View Results

http://www.certdepot.net/rhel7­set­local­repository­lab/ 5/7

You might also like