hadoop集群ambari搭建(2)之制作hadoop本地源

jopen 9年前

准备好源资源服务器,我使用之前的一台node4,配置都是1GB内存20GB存储

集群最好的安装方式一定是通过本地源的,如果是公共源,那么网络将会严重影响我们的安装进度。所以制作本地源是每一个大数据工作者的必会技能。

1:制作ambari(1.4.1.25)本地源

下载ambari repo

复制到yum repo目录

 [root@node4 ~]# cp ambari.repo /etc/yum.repos.d/

安装 yum-utils 其中有个命令是同步命令reposync 用来同步远程的yum repository

用法: reposync --repoid=base

[root@node4 ~]# yum install yum-utils</span>

查看我们repo里面有什么:

[root@node4 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.psu.ac.th
 * extras: mirrors.psu.ac.th
 * updates: mirrors.psu.ac.th
repo id                                                       repo name                                                                                           status
HDP-UTILS-1.1.0.16                                            Hortonworks Data Platform Utils Version - HDP-UTILS-1.1.0.16                                           61
Updates-ambari-1.4.1.25                                       ambari-1.4.1.25 - Updates                                                                               5
ambari-1.x                                                    Ambari 1.x                                                                                              5
base                                                          CentOS-6 - Base                                                                                     6,575
cloudera-cdh5                                                 Cloudera CDH, Version 5.5.1                                                                           146
cloudera-manager                                              Cloudera Manager, Version 5.5.1                                                                         7
extras                                                        CentOS-6 - Extras                                                                                      48
keytrustee                                                    Cloudera Navigator Key Trustee, Version 5.5.0                                                           1
updates                                                       CentOS-6 - Updates                                                                                    958
repolist: 7,806

将网络源中的包同步到本地:

reposync -r HDP-UTILS-1.1.0.16

reposync -r Updates-ambari-1.4.1.25

reposync -r ambari-1.x


 HDP-UTILS-1.1.0.16 Updates-ambari-1.4.1.25 ambari-1.x复制到 /var/www/html/ambari下 </div> </div>
cd /var/www/html/ambari
createrepo ./    #[root@node4 hdp]# yum install createrepo 


2:准备hortonworks hadoop HDP2.0.6本地源

准备HDP网络源

[root@node4 ~]# vi /etc/yum.repos.d/HDP.repo

vi /etc/yum.repos.d/HDP.repo,添加以下内容

[HDP-2.0.6]

name=HDP

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

enabled=1

gpgcheck=0


[root@node4 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vinahost.vn
 * extras: mirrors.vinahost.vn
 * updates: mirrors.vinahost.vn
HDP-2.0.6                                                                                                                                        | 2.9 kB     00:00
HDP-2.0.6/primary_db                                                                                                                             |  70 kB     00:01
repo id                                                       repo name                                                                                           status
HDP-2.0.6                                                     HDP                                                                                                   156
HDP-UTILS-1.1.0.16                                            Hortonworks Data Platform Utils Version - HDP-UTILS-1.1.0.16                                           61
Updates-ambari-1.4.1.25                                       ambari-1.4.1.25 - Updates                                                                               5
ambari-1.x                                                    Ambari 1.x                                                                                              5
base                                                          CentOS-6 - Base                                                                                     6,575
cloudera-cdh5                                                 Cloudera CDH, Version 5.5.1                                                                           146
cloudera-manager                                              Cloudera Manager, Version 5.5.1                                                                         7
extras                                                        CentOS-6 - Extras                                                                                      48
keytrustee                                                    Cloudera Navigator Key Trustee, Version 5.5.0                                                           1
updates                                                       CentOS-6 - Updates                                                                                    958
repolist: 7,962


reposync -r HDP-2.0.6  

耐心等待。
同步完成,检查文件夹
[root@node4 ~]# ll
total 600
drwxr-xr-x   3 root root   4096 Dec 29 09:45 ambari-1.x
drwxr-xr-x  17 root root   4096 Dec 29 12:39 HDP-2.0.6
drwxr-xr-x  18 root root   4096 Dec 29 09:40 HDP-UTILS-1.1.0.16
</div>

查看文件大小:
du: cannot access `work/testing': No such file or directory
[root@node4 ~]# du -h --max-depth=1 
65M     ./HDP-UTILS-1.1.0.16
2.8M    ./iptraf-3.0.0
8.0K    ./.pki
38M     ./ambari-1.x
2.1G    ./HDP-2.0.6
2.2G    . 

HDP-2.0.6 复制到http server的/var/www/html/hdp下
</div>
cd /var/www/html/hdp

createrepo ./  
create是创建的意思,repo是repository的缩写,是仓库的意思。
yum(Yellow dog Updater,Modified)主要的功能是方便添加、删除和更新rpm软件包。可以解决软件包依存问题,更便于管理大量的系统更新问题。它可以同时配置多个仓库或叫资源库(repository),就是存放更新和依存的软件包的地方。

[root@node4 hdp]# yum install createrepo 
</div>
[root@node4 hdp]# createrepo ./
Spawning worker 0 with 131 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
</div>
这样hadoop的本地源就做好了

打开链接:http://192.168.1.44/hdp/

3.制作Centos系统源

手动mount系统光盘
[root@node4 mnt]# mount /dev/cdrom  /var/www/html/centos/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@node4 mnt]# cd /var/www/html/centos/
[root@node4 centos]# ll
total 82
-r--r--r-- 1 root root    14 Nov 29  2013 CentOS_BuildTag
dr-xr-xr-x 3 root root  2048 Nov 29  2013 EFI
-r--r--r-- 1 root root   212 Nov 27  2013 EULA
-r--r--r-- 1 root root 18009 Nov 27  2013 GPL
dr-xr-xr-x 3 root root  2048 Nov 29  2013 images
dr-xr-xr-x 2 root root  2048 Nov 29  2013 isolinux
dr-xr-xr-x 2 root root 40960 Nov 29  2013 Packages
-r--r--r-- 1 root root  1354 Nov 27  2013 RELEASE-NOTES-en-US.html
dr-xr-xr-x 2 root root  4096 Nov 29  2013 repodata
-r--r--r-- 1 root root  1706 Nov 27  2013 RPM-GPG-KEY-CentOS-6
-r--r--r-- 1 root root  1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 1 root root  1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 1 root root  1734 Nov 27  2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 root root  3380 Nov 29  2013 TRANS.TBL
</div> </div>

4.制作HDP-UTILS-1.1.0.17源

到此本地源就差不多了,但是到了安装的时候发现
 redhat6
HDP-2.0
HDP-UTILS-1.1.0.17而不是我们安装的HDP-UTILS-1.1.0.16所以我们需要再次重复以上的步骤,下载HDP-UTILS-1.1.0.17源
修改ambari.repo
</div> </div>
[root@node4 yum.repos.d]# vi ambari.repo 
[ambari-1.x]
name=Ambari 1.x
gpgcheck=1
enabled=1
priority=1

[HDP-UTILS-1.1.0.17]
name=Hortonworks Data Platform Utils Version - HDP-UTILS-1.1.0.17
gpgcheck=0
enabled=1
priority=1

[Updates-ambari-1.4.1.25]
name=ambari-1.4.1.25 - Updates
gpgcheck=1
enabled=1
priority=1
</div>
</div>

[root@node4 yum.repos.d]# reposync -r HDP-UTILS-1.1.0.17

HDP-UTILS-1.1.0.17复制到server即可

至此,我们有三个源:



Charles 2015-12-30于Phnom Phen




版权说明:
本文由Charles Dong原创,本人支持开源以及免费有益的传播,反对商业化谋利。
CSDN博客:http://blog.csdn.net/mrcharles
</div>
个人站:http://blog.xingbod.cn
EMAIL:charles@xingbod.cn
</div>

来自: http://blog.csdn.net//mrcharles/article/details/50432811