1.关闭防火墙和selinux
2.创建hadoop用户
3.下载hadoop包并解压
https://archive.apache.org/dist/hadoop/common/
4.配置系统环境 /etc/hosts
添加
192.168.4.150 nutch #主机名
5.java -version #查看java 版本号
安装java环境
#java
export JAVA_HOME=/usr/java/jdk1.7.0_25
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#hadoop-1.2.1
export HADOOP_HOME=/home/tanj/hadoop
export HADOOP_BIN=/home/tanj/hadoop/bin
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
source .bash_profiile
6.配置ssh无密码登陆
cd
#ssh-keygen -t rsa --------------------然后一直按回车键,就会按照默认的选项将生成的
密钥保存在.ssh/id_rsa文件中。
ls -a
默认在 ~/.ssh目录生成两个文件:
id_rsa :私钥
id_rsa.pub :公钥
#cd ~/.ssh
#cp id_rsa.pub authorized_keys
|cat ~/.ssh/id_rsa.pub >> .ssh/authorized_keys
这步完成后,正常情况下就可以无密码登录本机了,即ssh newzqsoft.com.cn,无需输入密码。
Last login: Tue Dec 22 13:31:50 2015 from newzqsoft.com.cn
3、拷贝秘钥到其他机器
#cd ~/.ssh
#ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
测试 ssh nutch date
Tue Dec 22 13:33:07 CST 2015
7.
1.vim /home/hadoop/conf/hadoop-env.sh
export JAVA_HOME=/usr/local/jdk1.7.0_40
export HADOOP_COMMON_HOME=/home/hadoop/hadoop
2.vim /home/hadoop/conf/core-site.xml
<property>
<name>fs.default.name</name>
<value>hdfs://nutch:9000</value>
</property>
3.vim /home/hadoop/conf/hdfs-site.xml
<property>
<!--开启web hdfs-->
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property> #初装可以不要
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
4.vim /home/hadoop/conf/mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>nutch:9001</value>
</property>
</configuration>
格式化:要先格式化HDFS:
hadoop namenode -format
启动:
start-all.sh
查看进程:jps
7448 ResourceManager
8277 SecondaryNameNode
7547 NodeManager
8079 DataNode
7975 NameNode
8401 Jps
http://192.168.4.150:50090
http://192.168.4.150:50070