Step by Step Tutorial for Ambari Installation

features

System Requirements

At first, we need to think about the setups of VMs. So, I list a table for VMs below.

hostname ip operating system RAM disk space package
master1.bigdata.com 192.168.110.150 centos6.5 64 位 16g 50g ambari-server
namenode
slave1.bigdata.com 192.168.110.151 centos6.5 64 位 16g 50g ambari-agent
datanode
slave2.bigdata.com 192.168.110.152 centos6.5 64 位 16g 50g ambari-agent
datanode

VM Deployment

  1. Login VMware vsphere client system

  2. Create 3 VMs with specific system requirements

  3. Set the name of VM

  4. Choose data storage

  5. Choose hardware configuration

  6. Load centos6 ios file into CD-ROM when booting
    You can use the minimum version of the centos. Then you need to click the option “Running system installation with system booting”.

  7. Configuration complete

  8. Operating system installation

  9. Power on the VM

    1. Choose the first one.
      Choose the first one
  10. Click “skip” to continue.
    Click "skip" to continue

  11. Choose language, keyborad and timezone.
    Choose language
    Choose keyboard
    Choose timezone

  12. Set root password.
    Set root password

  13. Click “Using entire drive” to continue.
    Click "Using entire drive" to continue

  14. Choose “Write changes to disk” to continue.
    Choose "Write changes to disk" to continue

  15. Reboot.
    Reboot

VM Preparation

1. Configuration and Installation for VMs(master and slave servers)

  1. Install java.

    1
    yum -y install java
  2. Enable network adapter.

    1
    2
    3
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    vi /etc/sysconfig/network-scripts/ifcfg-eth1
    vi /etc/sysconfig/network-scripts/ifcfg-eth2

    Then, enable it to run after system booting

    1
    ONBOOT=yes
  3. Using tool ping to check the status of accessing public network and local network.

  4. Change the system’s hostname on all servers.

    1. Update file(/etc/sysctl.conf), add a item

      1
      kernel.domainname=master1.bigdata.com
    2. Update file(/etc/hosts), add doamins.

      1
      2
      3
      192.168.110.150 master1.bigdata.com master1
      192.168.110.151 slave1.bigdata.com slave1
      192.168.110.152 slave2.bigdata.com slave2
    3. Update file(/etc/sysconfig/network)

      1
      2
      NETWORKING=yes
      HOSTNAME=master1.bigdata.com
    4. Reboot systems

    5. Check the correction of hostname

      1
      2
      hostname
      hostname -f
  5. Set up password-less SSH on all servers

    1. Disable SELinux

      1
      vi /etc/selinux/config

      Set disabled for SELinux:

      1
      SELINUX=disabled
    2. Enable access for using public key.
      Warning: Filename is sshd_config, not ssh_config.

      1
      vi /etc/ssh/sshd_config

      Delete comment signal(“#”) blow:

      1
      2
      3
      RSAAuthentication yes
      PubkeyAuthentication yes
      AuthorizedKeysFile .ssh/authorized_keys
    3. Generate public key and private key on master server.

      1
      ssh-keygen -t rsa

      Then, click the default option for configuration.

    4. Create directories and copy the public key to slave servers.

      1
      2
      3
      slave$ mkdir ~/.ssh
      slave$ cd ~/.ssh
      slave$ touch authorized_keys

      Login to master server, then copy public key:

      1
      maseter$ scp ~/.ssh/id_rsa.pub root@slave1:~/.ssh

      Login to slave server, then copy content from public key to a file(authorized_keys):

      1
      slave$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

      Notice: You need to copy your content of local ssh public key to your local authorized_keys if you use standalone mode.

  6. Install ntpd on all servers.

    1. Check to see if you have installed ntpd.

      1
      rpm -qa | grep ntp   
    2. If not, install ntpd

      1
      yum -y install ntp 
  7. Close transparent huge page on all servers.

    1. Append code block to file(/etc/rc.local) for closing transparent huge page.

      1
      vi /etc/rc.local

      code block:

      1
      2
      3
      4
      5
      6
      if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
      echo never > /sys/kernel/mm/transparent_hugepage/enabled
      fi
      if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
      echo never > /sys/kernel/mm/transparent_hugepage/defrag
      fi
    2. Reboot operating system.

    3. Check the status of the transparent huge page to ensure the status is “never”.

      1
      cat /sys/kernel/mm/transparent_hugepage/enabled

2. Set up a local repository on master server.

  1. Install local repository tool.

    1
    yum install yum-utils createrepo
  2. Install the http service.

    1
    yum install httpd
  3. Start the http service.

    1
    service httpd start
  4. Install tool wget.

    1
    yum -y install wget
  5. Download Ambari & HDP package files to the master server.

    1
    2
    3
    wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.2.0/ambari-2.4.2.0-centos6.tar.gz
    wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6/HDP-UTILS-1.1.0.20-centos6.tar.gz
    wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.3.0/HDP-2.4.3.0-centos6-rpm.tar.gz
  6. Copy Ambari and HDP packages to http dir, then untar them.

    1
    2
    3
    4
    5
    cd /var/www/html
    mkdir hdp
    tar -xvf ambari-2.4.2.0-centos6.tar.gz -C /var/www/html
    tar -xvf HDP-2.4.3.0-centos6-rpm.tar.gz -C /var/www/html/hdp
    tar -xvf HDP-UTILS-1.1.0.20-centos6.tar.gz -C /var/www/html/hdp
  7. Check repository address for next step.

    Ambari base URL and gpgkey:

    1
    2
    http://192.168.110.150/AMBARI-2.4.2.0/centos6/2.4.2.0-136/  
    http://192.168.110.150/AMBARI-2.4.2.0/centos6/2.4.2.0-136/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins

    HDP base URL and gpgkey:

    1
    2
    http://192.168.110.150/hdp/HDP/centos6/2.x/updates/2.4.3.0
    http://192.168.110.150/hdp/HDP/centos6/2.x/updates/2.4.3.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins

    HDP-UTILS base URL and gpgkey(gpgkey file same with HDP gpgkey file):

    1
    2
    http://192.168.110.150/hdp/HDP-UTILS-1.1.0.20/repos/centos6
    http://192.168.110.150/hdp/HDP/centos6/2.x/updates/2.4.3.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
  8. Copy repository config files.
    ambari repo file:

    1
    wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.4.3.0/ambari.repo -O /etc/yum.repos.d/ambari.repo

    hdp repo file:

    1
    cp /var/www/html/hdp/HDP/centos6/2.x/updates/2.4.3.0/hdp.repo /etc/yum.repos.d/
  9. Update repository config files.
    You ought to renew base URL and gpgkey URL in your ambari.repo and hdp.repo files.

3. Ambari-server setup on master server

  1. Install ambari server

    1
    yum install /var/www/html/AMBARI-2.4.2.0/centos6/2.4.2.0-136/ambari/ambari-server-2.4.2.0-136.x86_64.rpm
  2. Run command for ambari setup.

    1
    ambari-server setup
  3. If you do not disable the SELinux, you need to press “y”.

  4. If your Ambari server under user root, you just need to press “n”.

  5. If you do not disable iptalbes, you need to press “y” to continue.

  6. Select the JDK version, then follow steps to install it.
    If you use a custom JDK, you will maybe meet some troubles that will happen within Ambari Installation. So, choosing option one for the recommendation.

  7. Choose database type
    You can choose embedded the database. If you choose MySQL, you need to install the MySQL database on the master server and input info for the Ambari setup. Then put a MySQL connector into a specific path and run the command below to specify the path of the connector.

    1
    ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
  8. Run ambari-server

    1
    ambari-server start

4. Ambari-agent setup on slave servers.

  1. Copy ambari-agent rpm file to slave servers.

    1
    scp /var/www/html/AMBARI-2.4.2.0/centos6/2.4.2.0-136/ambari/ambari-agent-2.4.2.0-136.x86_64.rpm root@slave_server_ip:~
  2. Install ambari-agent.

    1
    yum install ~/ambari-agent-2.4.2.0-136.x86_64.rpm
  3. Renew ambari-server URL in config file.

    1
    vi /etc/ambari-agent/ambari.ini

    Renew ambari-server URL below:

    1
    2
    [server]
    hostname = master1.bigdata.com
  4. Run ambari-agent.

    1
    ambari-agent start

Installation

Before you launch the Ambari installation web UI, you ought to ensure things below.

  1. Start the service httpd.

  2. Stop the service iptables.

  3. Start the ambari-server on the master server and ambari-agent on slave servers.
    If you want to start quickly, it is advisable to choose default options.

  4. Open your browser, then access to the WebUI and click the item (“Launch Install Wizard”)
    URL: 192.168.110.150:8080
    Account: admin
    Password: admin
    login
    login_success

  5. Get Started
    Get Started

  6. Select Version
    Choose local repository, then input base URL of HDP and HDP-UTILS.
    Select Version

  7. Install Options
    Input your master’s hostname and slaves’ hostnames. Then copy your master’s ssh private key into the item.
    Install Options

  8. Confirm Hosts
    Confirm Hosts

    Just click “ok” to continue.
    click ok

  9. Choose Services
    Choose what service you want to add to your system. You can add new services to your system later on.
    Choose Services

    Just click “ok” to continue.
    click ok

  10. Assign Masters
    Assign Masters

  11. Assign Slaves and Clients
    Assign Slaves and Clients

  12. Customize Services
    You just need to input info for items with a red exclamation mark.
    Customize Services

  13. Review
    Review

  14. Install, Start and Test
    If you get to this step successfully, you can drink a cup of coffee and enjoy this time.
    Install, Start and Test

  15. Summary
    So now, say hello world to Ambari.
    Install, Start and Test