在虚拟机上安装Centos6.5操作系统,建议使用64位的操作系统。
修改系统自带的yum源,使用国内的yum源的话yum的速度会快一点 1、备份系统源 # cd /etc/yum.repos.d # mv CentOS-Base.repo CentOS-Base.repo.bak 2、设置默认源为163 # wget http://mirrors.163.com/.help/CentOS6-Base-163.repo # mv CentOS6-Base-163.repo CentOS-Base.repo 3、执行yum源更新 # yum clean all // 清除以前的缓存 # yum makecache // 重建缓存 # yum update
关闭防火墙
1、重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2、关闭SELinux sudo gedit /etc/selinux/config # 改为 SELINUX=disabled
安装ntp,保证系统时间一致
yum install ntp service ntpd start
更新openssl 、 python
yum upgrade openssl yum update python
安装ssh免密码登陆
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,安装自己的JDK
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
sudo gedit /etc/hosts
安装ambari
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_*