linux环境tomcat配置及hadoop 2.6伪分布模式安装配置

一、ubuntu 15.04、openjdk1.7、tomcat7环境配置

1. 配置openjdk1.7,输入命令:

sudo apt-get install openjdk--jdk

2. 查看java是否安装成功,输入命令:

env
java -version

3. 查看jdk真实安装路径,如果是解压安装则用whereis java

update-alternatives --config java

4. 配置java环境变量,在/etc/profile文件下加入以下代码

export JAVA_HOME=/usr/lib/jvm/java-1.7.-openjdk-adm64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/lib:${JRE_HOME}/lib:$PATH

5. 显示java安装成功后,到apache官网下载tomcat安装包

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.65/bin/apache-tomcat-7.0.65.tar.gz

6. 解压下载包,并修改名称

tar -xzvf apache-tomcat-7.0.65.tar.gz
mv apache-tomcat-7.0..tar.gz tomcat7

7. 将tomcat移动到/usr/local文件目录下

sudo mv tomcat7 /usr/local

8. 配置环境变量,在该文件最后加入环境变量

sudo vi /etc/profile
export CATALINA_HOME=/usr/local/tomcat7

9. 修改tomcat内部文件

cd /usr/local/tomcat7
vi bin/catalina.sh
CATALINA_HOME=/usr/local/tomcat7
JAVA_HOME=/usr/lib/jvm/java--openjdk-adm64

10. 启动tomcat

sudo ./bin/startup.sh

11.如无异常成启动成功共即可访问

http://localhost:8080

二、redhat下配置tomcat

首先安装好yum,其他配置与ubuntu相似

三、hadoop2.6伪分布模式配置

1. 从官网下载hadoop2.6

wget http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz

2. 解压并重命名为hadoop

tar -xzvf hadoop-2.6..tar.gz
mv hadoop-2.6. hadoop

3. 将hadoop移动到/usr/local目录下

mv hadoop /usr/local/

4. 配置文件, 进入hadoop目录下,配置etc/hadoop/core-site.xml和etc/hadoop/hdfs-site.xml

<!-- etc/hadoop/core-site.xml. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
<!-- etc/hadoop/hdfs-site.xml -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/data</value>
</property>
</configuration>

5. 安装ssh,输入命令:

ssh localhost
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

按照提示安装完成即可。

6. 将hadoop配置到系统环境变量中,

1)在/etc/profile最后加入

#set hadoop path
export HADOOP_HOME=/usr/local/hadoop-2.6.
export PATH=$PATH:$HADOOP_HOME/bin

2)将hadoop目录下的etc/hadoop/hadoop-evn.sh文件的java路径改为:

#export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=/usr/lib/jvm/java-1.7.-openjdk-amd64

7. 执行hadoop,详见官网参考文件: http://hadoop.apache.org/docs/r2.6.0/hadoop-project-dist/hadoop-common/SingleCluster.html

上一篇:3-2 Hadoop集群伪分布模式配置部署


下一篇:POI导出EXCEL经典实现(转)