版本:
操作系统版本:
OS:ubuntu-18.04.5-live-server-amd64.iso
java:jdk1.8.0_141
mysql:mysql5.7(操作系统自带)
mysql-connect-java: mysql-connector-java-5.1.20-bin.jar
HDP:HDP-3.1.0.0-ubuntu18
1、设置ssh不超时
在/etc/profile中设置 export TMOUT=0
在sshd配置文件中添加这个:
ClientAliveInterval 300
ClientAliveCountMax 3
2、设置ssh互信(注意mater本机自身也要能够自动登录)
ssh-keygen
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.72.17
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.72.18
ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.72.29
3、以Ubuntu18.04为例配置阿里源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list
注释掉之前的官方安装源,添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
执行:
sudo apt-get update
4、安装http服务:
apt-get install apache2
systemctl status apache2
查看服务是否正常
5、放置安装源
cd /var/www/html
tar zxvf ambari-2.7.3.0-ubuntu18.tar.gz -C /var/www/html
tar zxvf HDP-3.1.0.0-ubuntu18-deb.tar.gz -C /var/www/html
tar zxvf HDP-GPL-3.1.0.0-ubuntu18-gpl.tar.gz -C /var/www
tar zxvf HDP-UTILS-1.1.0.22-ubuntu18.tar.gz -C /var/www
6、配置hdp的镜像源
在/etc/apt/sources.list.d/路径下分别添加 ambari.list 和 ambari-hdp.list
cd /etc/apt/sources.list.d
# ambari.list
deb http://192.168.72.30/ambari/ubuntu18/2.7.3.0-139/ Ambari main
# ambari-hdp.list
deb http://192.168.220.136/HDP/ubuntu18/3.1.0.0-78/ HDP main
deb http://192.168.220.136/HDP-GPL/ubuntu18/3.1.0.0-78/ HDP-GPL main
deb http://192.168.220.136/HDP-UTILS/ubuntu18/1.1.0.22/ HDP-UTILS main
添加key,不然会出现public key校验失败
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B9733A7A07513CAD
apt-get update
7、安装mysql(默认5.7版本)
apt-get install mysql-server
apt-get install mysql-client
apt-get install libmysqlclient-dev
设置root密码:
root@mhost001:/etc/apt/sources.list.d# cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = LGyqRd8t5kZUq2Vi
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = LGyqRd8t5kZUq2Vi
socket = /var/run/mysqld/mysqld.sock
登录并修改密码:
mysql -u debian-sys-maint -p LGyqRd8t5kZUq2Vi
use mysql;
update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
exit;
service mysql restart
mysql -u root -p 输入密码登录验证
8、配置java环境变量
export JAVA_HOME=/usr/local/java/jdk1.8.0_141
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}:${JAVA_HOME}:${JRE_HOME}
9、在 mysql 中执⾏ amabri 的建表脚本,同时创建对应的账号密码
SQL
-- 创建ambari专用的数据库
CREATE DATAbase `ambari`;
CREATE USER 'ambari'@'%' IDENTIFIED BY 'bigdata123';
grant all privileges on ambari.* to 'ambari'@'%';
-- 刷新权限
flush privileges;
10、修改mysql监听的ip地址
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 8718/mysqld
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 752/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1192/sshd
11、执行Ambari安装
ambari-server setup
12、指定驱动的路径
mv mysql-connector-java-5.1.20-bin.jar /usr/share/java/mysql-connector-java.jar
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
13、启动Ambari
ambari-server start
14、登录Ambari
http://192.168.72.XX:8080/
FAQ:
出现这种情况属于之前setup Ambari连接数据库出现的问题,需要在进行数据库初始化
Exception [Eclipselink-4002] (Eclipse Persistence Services - 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ambari.metainfo' doesn't exis
采用ambari登录数据库,执行
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql



