hadoop集群搭建(ip设置和jdk安装)
刚刚学习hadoop,安装有点吃力,希望通过记录过程能够给遇到同样问题的人一个答案。话不多说直接进入主题。
在公司拿来了三台电脑首先安装linux系统,这里不多说细节,唯一注意的ip设置好就可以了。下面介绍我建起hadoop集群的过程(非常详细因为是菜鸟,高手就不用看了):
1.配置ip:
可以写文件,也可以用界面方式安装,这里我用的是setup命令(因为方便),运行setup出现如下界面:
进入Networkconfiguration(可用Tab键切换到run Tool):
配置eth0网卡(到Use DHCP时按‘空格’即可编写ip地址):
配置完成后退出;执行
[root@localhost~]# /etc/init.d/network restart
出现如下则说明重启ip成功
Shutting downinterface eth0: [ OK ]
Shutting downloopback interface: [ OK ]
Bringing uploopback interface: [ OK ]
Bringing upinterface eth0: [ OK ]
2.安装jdk:
安装jdk1.7版本,这里有点麻烦因为安装linux存在一个java版本为1.4,而hadoop需要最低版本为1.6所以我们要先卸掉原有的java版本:
[root@localhostbin]# rpm -qa |grep -i java 查看存在java安装情况
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
[root@localhost bin]# yum removejava-1.4.2-gcj-compat 删除原有的java安装
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.4.2-gcj-compat.i3860:1.4.2.0-40jpp.115 set to be erased
--> Processing Dependency:java-gcj-compat for package: antlr
--> Processing Dependency:java-gcj-compat for package: antlr
--> Processing Dependency:java-gcj-compat >= 1.0.64 for package: gjdoc
--> Processing Dependency:java-gcj-compat >= 1.0.64 for package: gjdoc
--> Running transaction check
---> Package antlr.i386 0:2.7.6-4jpp.2set to be erased
---> Package gjdoc.i386 0:0.7.7-12.el5set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
java-1.4.2-gcj-compat i386 1.4.2.0-40jpp.115 installed 441
Removing for dependencies:
antlr i386 2.7.6-4jpp.2 installed 2.5 M
gjdoc i386 0.7.7-12.el5 installed 1.7 M
Transaction Summary
================================================================================
Remove 3 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)
Is this ok [y/N]: y #########是否删除级联packages(输入Y)
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : antlr 1/3
Erasing : gjdoc 2/3
Erasing :java-1.4.2-gcj-compat 3/3
Removed:
java-1.4.2-gcj-compat.i386 0:1.4.2.0-40jpp.115
Dependency Removed:
antlr.i386 0:2.7.6-4jpp.2 gjdoc.i386 0:0.7.7-12.el5
Complete! ##########安装完成
安装新版本jdk 下载地址
http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html
下载完成后:执行
rpm -ivhjdk-7u1-linux-i586.rpm ###安装jdk
等待完成后默认的jdk目录为:
[root@localhostjava]# ll /usr/java/
total 4
lrwxrwxrwx 1 root root 16 Dec 2 00:57 default ->/usr/java/latest
drwxr-xr-x 10root root 4096 Dec 2 00:57 jdk1.7.0_01 ###jdk
lrwxrwxrwx 1 root root 21 Dec 2 00:57 latest ->/usr/java/jdk1.7.0_01
如果要删除rpm可以:
[root@localhostjava]# rpm -qa |grep jdk ###查看jdk包信息
jdk-1.7.0_01-fcs
[root@localhostjava]# rpm -e jdk-1.7.0_01-fcs ###删除jdk
查看java版本信息:
[root@localhostjava]# java -version
java version"1.7.0_01"
Java(TM) SERuntime Environment (build 1.7.0_01-b08)
Java HotSpot(TM)Server VM (build 21.1-b02, mixed mode)
[root@localhostjava]# javac -version
javac 1.7.0_01