在虚拟机上安装Centos6.5操做系统,建议使用64位的操做系统。java
修改系统自带的yum源,使用国内的yum源的话yum的速度会快一点 一、备份系统源 # cd /etc/yum.repos.d # mv CentOS-Base.repo CentOS-Base.repo.bak 二、设置默认源为163 # wget http://mirrors.163.com/.help/CentOS6-Base-163.repo # mv CentOS6-Base-163.repo CentOS-Base.repo 三、执行yum源更新 # yum clean all // 清除之前的缓存 # yum makecache // 重建缓存 # yum update
关闭防火墙node
一、重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 二、关闭SELinux sudo gedit /etc/selinux/config # 改成 SELINUX=disabled
安装ntp,保证系统时间一致python
yum install ntp service ntpd start
更新openssl 、 pythonmysql
yum upgrade openssl yum update python
安装ssh免密码登录linux
ssh-keygen -t rsa一路回车 cd /root/.ssh/ cp id_rsa.pub authorized_keys chmod 600 authorized_keys cd /root/ chmod 700 -R .ssh
卸载centos6.5自带的JDK,安装本身的JDKsql
rpm -qa | grep java 把出现的文件所有删掉,例如: rpm -e --nodeps tzdata-java-2013g-1.el6.noarch rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64 上传新的jdk 解压,配置环境变量 sudo gedit /etc/profile 增长一下内容: JAVA_HOME=/usr/java/jdk1.7.0_79 JRE_HOME=/usr/java/jdk1.7.0_79/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH 使修改的文件生效: source /etc/profile
修改hosts文件数据库
sudo gedit /etc/hosts
安装ambaricentos
cd /etc/yum.repos.d/ wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.2.0.0/ambari.repo yum install ambari-server
在此要先关闭这台虚拟机,克隆多两台虚拟机,而后配置网络,相互ssh。例如 在amaster中:浏览器
ssh aslave1 y exit ssh aslave2 exit
确认无误以后回到amaster执行缓存
ambari-server setup [root@ambari ~]# 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): 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): 3 而后输入本身jdk安装的路径 JDK already exists, using /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 能够先安装mysql数据库,这里为了方便使用默认的 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): 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. 最后执行: ambari-server start
在浏览器输入:amaster:8080 登录的账密:admin admin 安装到倒数第二步的时候常常会出错,通常状况下是网络问题,你能够点击 retry 或者你能够看哪一个服务安装失败了,直接去失败的虚拟机yum.例如
而后直接去node3中执行一条命令,其余软件安装出错也能够这样作
yum install spark_2_2_*
建议一开始不要安装那么多服务,这样会很慢。你能够在成功以后一个个添加须要的软件。 出错了主要是要看错误的日志~