在虛擬機上安裝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_*
建議一開始不要安裝那麼多服務,這樣會很慢。你能夠在成功以後一個個添加須要的軟件。 出錯了主要是要看錯誤的日誌~