To deploy your Hadoop instance, you need to prepare your deployment environment:
• Set up Password-less SSH
On the master host
#/bin/sh
#Set Up Password-less SSH
master="zchxa1.eng.platformlab.ibm.com"
agents="zchxa2.eng.platformlab.ibm.com zchxa3.eng.platformlab.ibm.com"
all_hosts="$master $agents"
#On the master host
ssh-keygen -t rsa
cat id_rsa.pub >> authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
tar -zcvf ~/ssh.tar.gz ~/.ssh
for host in $agents
do
scp ~/ssh.tar.gz $host:/root/ssh.tar.gz
ssh $host "tar -zxvf /root/ssh.tar.gz -C /; cat /root/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys; rm -rf /root/ssh.tar.gz"
done
rm -rf ~/ssh.tar.gz
2. Prepare the NTP
#/bin/sh
#Set Up Password-less SSH
master="zchxa1.eng.platformlab.ibm.com"
agents="zchxa2.eng.platformlab.ibm.com zchxa3.eng.platformlab.ibm.com"
all_hosts="$master $agents"
for host in $all_hosts
do
#RHEL/CentOS/Oracle 6
ssh $host "chkconfig --list ntpd &”
#RHEL/CentOS/Oracle 7
#ssh $host "systemctl is-enabled ntpd"
#To set the NTP service to auto-start on boot, run the following command on each host:
#RHEL/CentOS/Oracle 6
ssh $host "chkconfig ntpd on"
#RHEL/CentOS/Oracle 7
#ssh $host "systemctl enable ntpd"
#To start the NTP service, run the following command on each host:
#RHEL/CentOS/Oracle 6
ssh $host "service ntpd start"
#RHEL/CentOS/Oracle 7
#ssh $host "systemctl start ntpd"
#Configuring iptables
#RHEL/CentOS/Oracle Linux 6
ssh $host "chkconfig iptables off"
ssh $host "/etc/init.d/iptables stop"
#RHEL/CentOS/Oracle Linux 7
#ssh $host "systemctl disable firewalld"
#ssh $host "service firewalld stop"
#Disable SELinux and PackageKit and check the umask Value
#/etc/yum/pluginconf.d/refresh-packagekit.conf
ssh $host "setenforce 0"
echo never > /sys/kernel/mm/transparent_hugepage/enabled;
echo never > /sys/kernel/mm/transparent_hugepage/defrag;
/etc/init.d/iptables stop
chkconfig iptables off
ssh $host "echo 'umask 0022' >> /etc/profile"
done
3. Getting Started Setting Up a Local Repository
yum install -y httpd
chkconfig httpd on
service httpd start
yum install -y yum-utils createrepo
mkdir -p /var/www/html/
# For RHEL and CentOS 7:
#yum install yum-plugin-priorities
# For RHEL and CentOS 6:
yum install -y yum-plugin-priorities
cd /var/www/html
tar -zxvf /media/sf_Hadoop/ambari-2.2.2.0-centos6.tar.gz -C /var/www/html
tar -zxvf /media/sf_Hadoop/HDP-2.2.0.0-centos6-rpm.tar.gz -C /var/www/html/
tar -zxvf /media/sf_Hadoop/HDP-UTILS-1.1.0.20-centos6.tar.gz -C /var/www/html/
cd ambari-2.2.2.0/centos6
cd /var/www/html
mkdir -p ambari/centos6
cd ambari/centos6
reposync -r Updates-ambari-2.2.2.0
cd /var/www/html
mkdir -p hdp/centos6
cd hdp/HDP/centos6
reposync -r HDP-2.2.2.0
reposync -r HDP-UTILS-1.1.0.20
Repository Base URL
Ambari Base URL http://192.168.1.6/ambari-2.2.2.0/centos6
HDP Base URL http://192.168.1.6/hdp/HDP/centos6/2.x/updates/2.2.2.0
HDP-UTILS Base URL http://192.168.1.6/hdp/HDP-UTILS-1.1.0.20/repos/centos
4. Generate the repository metadata
For Ambari:
createrepo /var/www/html/ambari/centos6/Updatesambari-2.2.2.0
createrepo /var/www/html/AMBARI-2.2.2.0/centos6
createrepo /var/www/html/Updatesambari-2.2.2.0
For HDP Stack Repositories:
createrepo /var/www/html/hdp/centos6/HDP-2.2.2.0
createrepo /var/www/html/hdp/centos6/HDP-UTILS-1.1.0.20
Or
#/bin/sh
#Set Up Password-less SSH
master="szw1"
agents="szw2 szw3"
all_hosts="$master $agents"
wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.2.2.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
sed -i "s/public-repo-1.hortonworks.com/`hostname -f`/g" /etc/yum.repos.d/ambari.repo
cp /var/www/html/HDP/centos6/2.x/GA/2.2.0.0/hdp.repo /etc/yum.repos.d/hdp.repo
sed -i "s/public-repo-1.hortonworks.com/`hostname -f`/g" /etc/yum.repos.d/hdp.repo
for host in $all_hosts
do
#RHEL/CentOS/Oracle 6
scp /etc/yum.repos.d/ambari.repo $host:/etc/yum.repos.d/ambari.repo
scp /etc/yum.repos.d/hdp.repo $host:/etc/yum.repos.d/hdp.repo
ssh $host "yum clean all; yum makecache; yum repolist"
done
yum repolist
yum install ambari-server
ambari-server setup -j /usr/java/jdk1.8.0_65