私有Yum源搭建(CentOS6.5)

本文以在 CentOS6.5 的服务器上搭建 Ambari 私有 Yum 源为例进行说明

目录


  • 所需资源列表
  • 安装基本软件并配置
  • 配置仓库(分两种情况)
  • 镜像服务器无法问Internet的情况
  • 镜像服务器可访问Internet的情况

所需资源列表


  • CentOS 6.5 x86_64 镜像
  • Ambari-2.0.1
  • 下载 Ambari 的公共库文件
$ sudo wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.2.1/ambari.repo
  • 将下载的 ambari.repo 文件拷贝到 Linux 的系统目录 /etc/yum.repos.d/

安装基本软件并配置


前置条件

  • 有一台空闲服务器,用作镜像服务器(这里我使用的是CentOS6.5,且我的这台机器可以访问Ineternet)
  • 集群其他机器可以通过网络访问到该服务器
  • 确保镜像服务器有软件管理工具,如yum (RHEL / CentOS / Oracle Linux), zypper (SLES), or apt-get (Debian/Ubuntu)

安装工具:yum-utils & createrepo

$ sudo yum install yum-utils createrepo

创建 HTTP 服务

在镜像服务器,安装HTTP服务 (例如: Apache httpd)

$ sudo yum install httpd

启动服务

$ sudo service httpd start

防火墙关闭或开放HTTP服务端口

给Web服务创建资源目录

$ sudo mkdir -p /var/www/html/

配置仓库(分两种情况)


  • 镜像服务器无法问Internet的情况
  • 镜像服务器可访问Internet的情况

镜像服务器无法问Internet的情况

下载需要的安装Tar包到镜像服务器

$ sudo wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.2.1/ambari-2.1.2.1-centos6.tar.gz
$ sudo wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.2.0/HDP-2.3.2.0-centos6-rpm.tar.gz
$ sudo wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6/HDP-UTILS-1.1.0.20-centos6.tar.gz

移动Tar包到Web服务目录并解压

$ sudo cd /var/www/html
$ sudo tar zxvf ambari-2.1.2.1-centos6.tar.gz
$ sudo tar zxvf HDP-2.3.2.0-centos6-rpm.tar.gz
$ sudo tar zxvf HDP-UTILS-1.1.0.20-centos6.tar.gz

确认可以在浏览器查看相关目录

  • Ambari Base URL
    http://<web.server>/ambari-2.1.2.1/<OS>
    <web.server> 就是这台服务器IP地址或域名
    <OS> 是下载的资源对应OS的目录
  • HDP Base URL
    http://<web.server>/hdp/HDP/<OS>/2.x/updates/<latest.version>
  • HDP-UTILS Base URL
    http://<web.server>/hdp/HDP-UTILS-<version>/repos/<OS>

镜像服务器可访问Internet的情况

下载Ambari和Stack的仓库配置文件到镜像服务器

$ sudo wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.2.1/ambari.repo
$ sudo wget wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.2.0/hdp.repo

确认当前仓库清单

$ sudo yum repolist

同步仓库中的内容到镜像服务器

进入Web服务目录

$ sudo cd /var/www/html

对于 Ambari 仓库, 创建 ambari 目录并同步内容

$ sudo mkdir -p ambari/<OS>
$ sudo cd ambari/<OS>
$ reposync -r Updates-ambari-2.1.2.1

其中 <OS> 为变量,根据实际情况改为: centos6, centos7, suse11, ubuntu12, ubuntu14, or debian7

对于 HDP Stack 仓库, 创建 hdp 目录并同步内容

$ sudo mkdir -p hdp/<OS>
$ sudo cd hdp/<OS>
$ sudo reposync -r HDP-<latest.version>
$ sudo reposync -r HDP-UTILS-<version>

生成仓库元数据

For Ambari

$ sudo createrepo <web.server.directory>/ambari/<OS>/Updates-ambari-2.1.2.1

For HDP Stack Repositories

$ sudo createrepo <web.server.directory>/hdp/<OS>/HDP-<latest.version>
$ sudo createrepo <web.server.directory>/hdp/<OS>/HDP-UTILS-<version>

确认可以在浏览器查看相关目录

  • Ambari Base URL
    http://<web.server>/ambari/<OS>/Updates-ambari-2.1.2.1
  • HDP Base URL
    http://<web.server>/hdp/<OS>/HDP-<latest.version>
  • HDP-UTILS Base URL
    http://<web.server>/hdp/<OS>/HDP-UTILS-<version>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容