1.Ambari 的安装准备
1.1 用VMWARE搭建三台linux虚拟机,三台机器配置免秘钥登录
1.1.1 三台虚拟机配置如下:
hostnaame | ip |
hpsk-master | 192.168.59.161 |
hpsk-slaver1 | 192.168.59.162 |
hpsk-slaver2 | 192.168.59.163 |
1.1.2配置hostname,设置主机名
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hadoop1
1.1.3配置host,设置ip和主机名的映射
# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.59.161 hpsk-master
192.168.59.162 hpsk-slaver1
192.168.59.163 hpsk-slaver2
1.1.4配置SSH免密钥登录
[root@hpsk-master yum.repos.d]# cd /etc/yum.repos.d/
[root@hpsk-master yum.repos.d]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
62:a2:d3:40:36:c2:1d:a3:c6:d2:75:5c:4f:98:bc:2b root@hpsk-master
The key's randomart image is:
+--[ RSA 2048]----+
| o...o.o. |
|o.o.o.. +o |
|o==. .. |
|o+ . . |
| . . o S. |
| + oE.. |
| o . . |
| . |
| |
+-----------------+
[root@hpsk-master yum.repos.d]# cd /root/.ssh/
[root@hpsk-master .ssh]# ls
id_rsa id_rsa.pub
[root@hpsk-master .ssh]# cat id_rsa.pub>>authorized_keys
[root@hpsk-master .ssh]# ls
authorized_keys id_rsa id_rsa.pub
[root@hpsk-master .ssh]# ssh root@hpsk-slave1 cat /root/.ssh/id_rsa.pub>> authorized_ke ys
root@hpsk-slave1's password:
[root@hpsk-master .ssh]# ssh root@hpsk-slave2 cat /root/.ssh/id_rsa.pub>> authorized_ke ys
The authenticity of host 'hpsk-slave2 (192.168.202.173)' can't be established.
RSA key fingerprint is 99:bf:9c:d2:93:3d:9d:94:1e:be:76:46:8f:83:d7:7f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hpsk-slave2,192.168.202.173' (RSA) to the list of known hosts.
root@hpsk-slave2's password:
[root@hpsk-master .ssh]# scp -r /root/.ssh/authorized_keys root@hpsk-slave1:/root/.ssh/ root@hpsk-slave1's password:
authorized_keys 100% 1182 1.2KB/s 00:00
[root@hpsk-master .ssh]# scp -r /root/.ssh/authorized_keys root@hpsk-slave2:/root/.ssh/
root@hpsk-slave2's password:
authorized_keys 100% 1182 1.2KB/s 00:00
[root@hpsk-master .ssh]# chmod 600 /root/.ssh/authorized_keys
1.2确保 Yum 可以使用
1.3安装ambari时候尽量用root安装
1.Ambari 的 Server 会 SSH 到 Agent 的机器,拷贝并执行一些命令。因此我们需要配置 Ambari Server 到 Agent 的 SSH 无密码登录。
2.Ambari 会创建一些 OS 用户。
2.Ambari安装
2.1下载Ambari 的公共库文件(public repository)
wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.1/ambari.repo
2.2将下载的 ambari.repo 文件拷贝到 Linux 的系统目录/etc/yum.repos.d/
mv ambari.repo /etc/yum.repos.d/ambari.repo
2.3获取该公共库的所有的源文件列表
[root@hpsk-master hadoop]# cd /etc/yum.repos.d/
[root@hpsk-master yum.repos.d]# yum clean all
[root@hpsk-master ~]# yum list|grep ambari
ambari-server.noarch 2.0.1-45 @Updates-ambari-2.0.1
ambari-agent.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-log4j.noarch 2.0.1.45-1 Updates-ambari-2.0.1
ambari-metrics-collector.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-common.noarch 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-hadoop-sink.x86_64 2.0.1-45 Updates-ambari-2.0.1
ambari-metrics-monitor.x86_64 2.0.1-45 Updates-ambari-2.0.1
hdp_mon_ganglia_addons.noarch 2.0.1.45-1.el6 Updates-ambari-2.0.1
hdp_mon_nagios_addons.noarch 2.0.1.45-1.el6 Updates-ambari-2.0.1
2.4安装 Ambari Server
[root@hpsk-master ambari-server]# yum install ambari-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ambari-server.noarch 0:2.0.1-45 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================
Package Arch Version Repository Size
===========================================
Installing:
ambari-server noarch 2.0.1-45 Updates-ambari-2.0.1 86 M
Transaction Summary
===========================================
Install 1 Package(s)
Total download size: 86 M
Installed size: 104 M
Is this ok [y/N]: y
Downloading Packages:
ambari-server-2.0.1-45.noarch.rpm | 86 MB 18:34
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ambari-server-2.0.1-45.noarch 1/1
Verifying : ambari-server-2.0.1-45.noarch 1/1
Installed:
ambari-server.noarch 0:2.0.1-45
Complete!
[root@hpsk-master ambari-server]#
2.5配置 Ambari Server
[root@hpsk-master ambari-server]# ambari-server setup
Using python /usr/bin/python2.6
Setup ambari-server
Checking SELinux...
SELinux status is 'disabled'
Customize user account for ambari-server daemon [y/n] (n)? y
Enter user account for ambari-server daemon (root):root
Adjusting ambari-server permissions and ownership...
Checking iptables...
Checking JDK...
[1] Oracle JDK 1.7
[2] Oracle JDK 1.6
[3] - Custom JDK
=========================
Enter choice (1): 1
To download the Oracle JDK and the Java Cryptography Extension (JCE) Policy Files you must accept the license terms found at http://www.oracle.com/technetwork/java/javase/terms/license/index.html and not accepting will cancel the Ambari Server setup and you must install the JDK and JCE files manually.
Do you accept the Oracle Binary Code License Agreement [y/n] (y)? y
Downloading JDK from http://public-repo-1.hortonworks.com/ARTIFACTS/jdk-7u67-linux-x64.tar.gz to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
jdk-7u67-linux-x64.tar.gz... 100% (135.8 MB of 135.8 MB)
Successfully downloaded JDK distribution to /var/lib/ambari-server/resources/jdk-7u67-linux-x64.tar.gz
Installing JDK to /usr/jdk64/
Successfully installed JDK to /usr/jdk64/
Downloading JCE Policy archive from http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip to /var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
UnlimitedJCEPolicyJDK7.zip... 100%
Successfully downloaded JCE Policy archive to /var/lib/ambari-server/resources/UnlimitedJCEPolicyJDK7.zip
Installing JCE policy...
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? y
Configuring database...
=========================
Choose one of the following options:
[1] - PostgreSQL (Embedded)
[2] - Oracle
[3] - MySQL
[4] - PostgreSQL
=========================
Enter choice (1):
Database name (ambari):
Postgres schema (ambari):
Username (ambari):
Enter Database Password (bigdata):
Re-enter password:
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Running initdb: This may take upto a minute.
Initializing database: [ OK ]
About to start PostgreSQL
Configuring local database...
Connecting to local database...done.
Configuring PostgreSQL...
Restarting PostgreSQL
Extracting system views...
.ambari-admin-2.0.1.45.jar
..
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.
[root@hpsk-master ambari-server]#
2.6启动 Ambari
[root@hpsk-master ambari-server]# ambari-server start
Using python /usr/bin/python2.6
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start....................
Ambari Server 'start' completed successfully.
[root@hpsk-master ambari-server]#
2.7登录 Ambari server管理页面
1.登录URL:http://192.168.202.132:8080/,
2.登录账号密码:admin/admin
Ambari Server 就安装完成了。