1.安装相应的工具

yum install -y yum-utils createrepo httpd

2.修改/etc/httpd/conf/httpd.conf

#将DocumentRoot "/var/www/html"改为自己设置的路径/notebooks/download/hdp


# DocumentRoot "/var/www/html"
DocumentRoot "/notebooks/download/hdp"

3.启动httpd服务

systemctl start httpd

4.下载ambari

wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari.repo

wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/ambari-2.7.4.0-centos7.tar.gz

5.下载hdp

# hdp
wget http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/hdp.repo

wget http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0/HDP-3.1.4.0-centos7-rpm.tar.gz




# HDP-UTILS
wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7/HDP-UTILS-1.1.0.22-centos7.tar.gz


# HDP-GPL
wget http://public-repo-1.hortonworks.com/HDP-GPL/centos7/3.x/updates/3.1.4.0/hdp.gpl.repo

wget http://public-repo-1.hortonworks.com/HDP-GPL/centos7/3.x/updates/3.1.4.0/HDP-GPL-3.1.4.0-centos7-gpl.tar.gz

6.解压

tar -zxvf ambari-2.7.4.0-centos7.tar.gz
tar -zxvf HDP-3.1.4.0-centos7-rpm.tar.gz
tar -zxvf HDP-UTILS-1.1.0.22-centos7.tar.gz
tar -zxvf HDP-GPL-3.1.4.0-centos7-gpl.tar.gz

7.修改ambari.repo (同理修改其他的)

vim /etc/yum.repos.d/ambari.repo

#VERSION_NUMBER=2.7.4.0-118
[ambari-2.7.4.0]
#json.url = http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json
name=ambari Version - ambari-2.7.4.0
#baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0
baseurl=http://0.0.0.0/ambari/centos7/2.7.4.0-118
gpgcheck=1
#gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.7.4.0/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
gpgkey=http://0.0.0.0/ambari/centos7/2.7.4.0-118/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

vim /etc/yum.repos.d/hdp.repo

#VERSION_NUMBER=3.1.4.0-315
[HDP-3.1.4.0]
name=HDP Version - HDP-3.1.4.0
baseurl=http://0.0.0.0/HDP/centos7/3.1.4.0-315
gpgcheck=1
gpgkey=http://0.0.0.0/HDP/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1


[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://0.0.0.0/HDP-UTILS/centos7/1.1.0.22
gpgcheck=1
gpgkey=http://0.0.0.0/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

vim /etc/yum.repos.d/hdp.gpl.repo

#VERSION_NUMBER=3.1.4.0-315
[HDP-GPL-3.1.4.0]
name=HDP-GPL Version - HDP-GPL-3.1.4.0
baseurl=http://0.0.0.0/HDP-GPL/centos7/3.1.4.0-315
gpgcheck=1
gpgkey=http://0.0.0.0/HDP-GPL/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

8.yum创建缓存

yum clean all
yum makecache

# 查看仓库
yum repolist

9.安装ambari

#主节点
yum install ambari-server
#从节点
yum install ambari-agent

# 启动前先配置
ambari-server setup


ambari-server start

ambari-server status


ambari-server stop