To get started setting up your local repository, complete the following prerequisites:
- Select an existing server in, or accessible to the cluster, that runs a supported operating system.
- Enable network access from all hosts in your cluster to the mirror server.
- Ensure the mirror server has a package manager installed such as yum (RHEL / CentOS / Oracle Linux), zypper (SLES), or apt-get (Debian/Ubuntu).
- Optional: If your repository has temporary Internet access, and you are using RHEL/CentOS/Oracle Linux as your OS, install yum utilities:
yum install yum-utils createrepo
1.1、安装httpd:
yum install httpd
1.2、Apache启动出现错误:
[root@ www.linuxidc.com bin]# service httpd restart
AH00557: httpd: apr_sockaddr_info_get() failed for linux.64.114
AH00558: httpd: Could not reliably determine the server's fully qualified domain
name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
1.3、解决:
修改ServerName
vi /etc/httpd/conf/httpd.conf
#ServerName www.example.com:80
#添加这行
ServerName localhost:80
"/etc/httpd/conf/httpd.conf" 1011L, 34444C written
1.4 、启动httpd
service httpd start
或
/etc/initd/httpd start
启动成功:
[root@rhel1 yum.repos.d]# ps -ef | grep httpd
root 5936 1 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5939 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5940 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5941 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5942 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5943 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5944 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5945 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
apache 5946 5936 0 13:04 ? 00:00:00 /usr/sbin/httpd
root 5976 3487 0 13:09 pts/0 00:00:00 grep httpd
这时,直接在浏览器中输入服务器的IP地址,即可看到Apache2的默认页面。此时的Apache仅仅能提供HTTP服务,不能执行php、也不能连接MySQL数据库。
二、搭建yum源 2.1 Setting Up a Local Repository with No Internet Access参考: 2.1.1、 下载需要的包:
2.1.2、 复制到你的httpd设置的web server 目录:
vi /etc/httpd/cong/httpd.conf:
搜索web server 目录:/Document
2.1.3、解压你的tarball, ambari , hdp的解压有区别: 2.1.4、Confirm you can browse to the newly created local repositories:
FQDN:(Fully Qualified Domain Name)完全合格域名/全称域名,是指主机名加上全路径,全路径中列出了序列中所有域成员。 import: 记录这些urls, 但你在安装Ambari和集群时需要。 2.1.5、Optional: If you have multiple repositories configured in your environment, deploy the following plug-in on all the nodes in your cluster.
Install the plug-in. -
yum install yum-plugin-priorities
编辑
/etc/yum/pluginconf.d/priorities.conf
, 添加下列属性:
[main]
enabled=1
gpgcheck=0
2.2 Setting Up a Local Repository with No Internet Access
2.2.1、获取Ambari和HDP的 repository configuration文件:
2.2.2、确保库的可用性
yum repolist
2.2.3、同步镜像服务器和本地库 浏览服务器目录:
cd /var/www/html
对Ambari ,创建目录, 同步库:
mkdir -p ambari/
cd ambari/
reposync -r Updates-Ambari-2.4.2.0
对HDP Stack Repositories, 创建目录, 同步库:
mkdir -p hdp/
cd hdp/
reposync -r HDP-
reposync -r HDP-UTILS-
Generate the repository metadata:
- For Ambari:
createrepo /ambari//Updates-Ambari-2.4.2.0
- For HDP Stack Repositories:
createrepo /hdp//HDP-
createrepo /hdp//HDP-UTILS-
2.2.4、确保可以浏览创建的库:
[root@logs01 ~]# mount -o loop /opt/software/RHEL_6.3\ x86_64.iso /mnt/
[root@logs03 ~]# vim /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/Server #注意
enabled=1 #注意
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
三、总结
安装HDP 需要配置四个yum源:
- 配置本地DVD yum源(主要是解决linux系统包的依赖)
- ambari源配置文件三个
- ambari
- HDP
- HDP-UTILS
注意:将四个YUM源配置文件都COPY到所有要安装HDP的节点上
yum源配置: http://blog.itpub.net/25313300/viewspace-708509 官网的安装教程,很详细。