搭建 HDP 本地源

发布于 2021-05-16 19:58:07 字数 7181 浏览 1716 评论 0

目标是搭建 HDP 的 ubuntu14、centos7 和 centos6 的本地源。hortonworks.com 虽然提供了官方源,但受国际网络速度影响,安装时很容易出错。本地源的地址是 repo.imaicloud.com,只能通过浪潮内网访问,可以用浏览器访问这个地址看看。参考1

什么是 Base URL

在网页 Ambari barball 中提到了 Base URL。Base URL 是库的基础地址。

对于 ubuntu 操作系统,目录 /etc/apt/sources.list 文件中:

deb http://security.ubuntu.com/ubuntu yakkety-security universe

中的 http://security.ubuntu.com/ubuntu 就是 Base URL。
而对于 CentOS 操作系统,库文件位于 /etc/yum.repos.d/ 目录下,可以看一下 /etc/yum.repos.d/hdp.repo 文件中的 baseurl,如:

baseurl=http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.6.0.3

如果进入 unbuntu 操作系统(DPKG 标准)查看,发现在 base url 对应的目录之下是 dists 目录,这应是 apt 打包系统的约定。而 yakkety-security 是 dists 的下级目录,依次类推(空格隔开的多级目录)。

centos下(YUM标准)则没有 dists 目录,直接按 baseurl 创建目录即可。

建立本地源服务器

计划在 10.0.9.105 上建立 apt 本地源,定义一个域名 repo.imaicloud.com 指向 10.0.9.105 这个 IP 地址,这是个内网地址,只能在浪潮内网访问,在公司外需要先启动 VPN。9.105 的操作系统是 centos7,已经安装有 nginx。增加 nginx 的配置如下:

server {
        listen 80;
        root repo;
        index index.html index.htm index.nginx-debian.html;
        server_name repo.imaicloud.com;
        location / {
                autoindex on;
                try_files $uri $uri/ =404;
        }
}

进入 repo 目录,并从 HDP 官方下载 Amarbi、HDP、HDP-UTILS 的 ubuntu14 和 centos6 下的 tarball。首先下载 centos6 的 参考2

$ cd /opt/nginx/repo
$ wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.5.0.3/ambari-2.5.0.3-centos6.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.3.0/HDP-2.5.3.0-centos6-rpm.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6/HDP-UTILS-1.1.0.21-centos6.tar.gz

然后下载 ubuntu 14 的 参考3

$ wget http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.4.2.0/ambari-2.4.2.0-ubuntu14.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.5.3.0/HDP-2.5.3.0-ubuntu14-deb.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu14/HDP-UTILS-1.1.0.21-ubuntu14.tar.gz

下面是下载最新的 centos7 下的 ambari 2.5.1.0 和 HDP 2.6.1.0 参考4

$ wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.5.1.0/ambari-2.5.1.0-centos7.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.1.0/HDP-2.6.1.0-centos7-rpm.tar.gz
$ wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz

上面的参考 2、3、4 网页中每个 tarball 都显示有 md5,可以用下列命令计算出 md5 码,以避免下载不完整:

$ openssl md5 ambari-2.4.2.0-ubuntu14.tar.gz

解压tarball的命令类似:

$ tar -xzf ambari-2.4.2.0-ubuntu14.tar.gz

解压后需要确认一下 Amarbi、HDP、HDP-UTILS 的目录结构:

  • Ambari Base URL : http://<web.server>/Ambari-2.5.0.3/<OS>
  • HDP Base URL : http://<web.server>/HDP/<OS>/2.x/updates/<latest.version>
  • HDP-UTILS Base URL : http://<web.server>/HDP-UTILS-<version>/repos/<OS>

注意,参考1 的官方文档中,HDP 的 Base URL 是 http://<web.server>/hdp/HDP,本文中去掉了 hdp 这个目录。

本地源的目录

9.105 上实际部署的 HDP 版本可能与之前描述的不同(目前部署的 ambari 2.4.2.0),但原理相同。目前 9.105 上的本地源目录(位于 /opt/nginx 下):

repo/AMBARI-2.4.2.0/centos6
repo/AMBARI-2.4.2.0/ubuntu14
repo/ambari/centos7/2.x/2.5.0.3
repo/ambari/centos7/2.x/2.5.1.0
repo/HDP/centos6/2.x/updates/2.5.3.0
repo/HDP/centos7/2.x/updates/2.5.3.0
repo/HDP/centos7/2.x/updates/2.6.1.0
repo/HDP/ubuntu14
repo/HDP-UTILS-1.1.0.21/repos/ubuntu14
repo/HDP-UTILS-1.1.0.21/repos/centos6
repo/HDP-UTILS-1.1.0.21/repos/centos7

从目录上可以看出,9.105 的本地源提供的下载有 Ambari 2.4.2.0(centos6/ubuntu14)、Ambari 2.5.0.3(centos7)、HDP 2.5.3.0(centos6/centos7/ubuntu14)、HDP-UTILS-1.1.0.21(centos6/centos7/ubuntu14)。

目录到 URL 的转换:将 repo 替换为域名就是 BaseURL,如 http://repo.imaicloud.com/HDP/centos7/2.x/updates/2.5.3.0 就 HDP 2.5.3 在 centos7 的 BaseURL。

库描述文件

对于部署HDP的集群中的所有机器都要创建HDP本地源的库描述文件。

ubuntu 14

$ wget -O /etc/apt/sources.list.d/ambari.list http://repo.imaicloud.com/AMBARI-2.4.2.0/ubuntu14/2.4.2.0-136/ambari.list
$ wget -O /etc/apt/sources.list.d/HDP.list http://repo.imaicloud.com/HDP/ubuntu14/HDP.list

centos6

$ wget -O /etc/yum.repos.d/ambari.repo http://repo.imaicloud.com/AMBARI-2.4.2.0/centos6/2.4.2.0-136/ambari.repo
$ wget -O /etc/yum.repos.d/hdp.repo http://repo.imaicloud.com/HDP/centos6/2.x/updates/2.5.3.0/hdp.repo

centos7

$ wget -O /etc/yum.repos.d/ambari.repo http://repo.imaicloud.com/ambari/centos7/2.x/updates/2.5.0.3/ambari.repo
$ wget -O /etc/yum.repos.d/hdp.repo http://repo.imaicloud.com/HDP/centos7/2.x/updates/2.5.3.0/hdp.repo

centos7 ambari2.5.1.0 和 HDP2.6.1.0

$ wget -O /etc/yum.repos.d/ambari.repo http://repo.imaicloud.com/ambari/centos7/2.x/updates/2.5.1.0/ambari.repo
$ wget -O /etc/yum.repos.d/hdp.repo http://repo.imaicloud.com/HDP/centos7/2.x/updates/2.6.1.0/hdp.repo

HUE 本地下载

repo.imaicloud.com 上提供了 ubuntu14/centos6/centos7 的 HUE 3.12.0 版本 tar 包下载。目录分别是:

使用 163 源

163 源 centos 的 官方帮助

$ wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

在 CentOS7-Base-163.repo 中有个变量 $releasever 在 centos7.0 解析不正确(解析成了 7server),需要手工替换成了 7。而在 centos7.3 可以正确解析出来。

然后执行:

$ yum clean all
$ yum makecache

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

关于作者

JSmiles

生命进入颠沛而奔忙的本质状态,并将以不断告别和相遇的陈旧方式继续下去。

0 文章
0 评论
84959 人气
更多

推荐作者

一念一轮回

文章 0 评论 0

脱离于你

文章 0 评论 0

春夜浅

文章 0 评论 0

吃兔兔

文章 0 评论 0

晨曦

文章 0 评论 0

kevin123

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文