HDPCA Exam Objective – Configure a local HDP repository

Note: This is post is part of the HDPCA exam objective series

To be able to install HDP in enterprise environments we have to configure the local repositories. There are 2 repositories that are required to get an enterprise Hadoop cluster up and running, namely:
1. Ambari Repositories
2. HDP Stack Repositories

Configuring local repositories for Ambari and HDP Stack

1. Create a directory to store the ambari and HDP stack repository in the web server directory used to store the repositories (e.g. /var/www/html) on your local repository server.

# mkdir /var/www/html/ambari
# mkdir /var/www/html/hdp

2. Synchronize the repository contents to your repository server:

# reposync -r Updates-ambari-[version]
# reposync -r HDP-[latest.version]
# reposync -r HDP-UTILS-[version]

3. Generate the repository metadata.

# createrepo /var/www/ambari/Updates-ambari-[version]
# createrepo /var/www/hdp/HDP-[latest.version]
# createrepo /var/www/hdp/HDP-UTILS-[version]

4. Make sure that you can browse the new repositories you just created.

Repository Base URL
Ambari Base URL http://[web.server]/ambari/Updates-ambari-[version]
HDP Base URL http://[web.server]/hdp/HDP-[latest.version]
HDP-UTILS Base URL http://[web.server]/hdp/HDP-UTILS-[version]

5. Download the ambari.repo file using the wget command and place it in /etc/yum.repos.d directory.

# wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
2018-06-25 17:06:34 URL:http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/ambari.repo [306/306] -> "/etc/yum.repos.d/ambari.repo" [1]

6. The ambari repo file would look like below.

# cat /etc/yum.repos.d/ambari.repo
#VERSION_NUMBER=2.6.0.0-267
[ambari-2.6.0.0]
name=ambari Version - ambari-2.6.0.0
baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0
gpgcheck=1
gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.6.0.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

You can verify the ambari repo using the “yum repolist” command.

# yum repolist

Sample output:

Note: If you do not have access to internet, you can download the repository tarballs from the below links :
Ambari Repositories
HDP Stack Repositories
Related Post