- 利用apt-get install 命令安装cdh3,所以首先要添加它的库(repository),方法如下:
新建文件/etc/apt/sources.list.d/cloudera.list,内容如下
deb http://archive.cloudera.com/debian <RELEASE>-cdh3 contrib
deb-src http://archive.cloudera.com/debian <RELEASE>-cdh3 contrib
其中<RELEASE>部分要用lsb_release -c命令的结过替换。如我的电脑的执行结果如下所示
那么替换的结果如下所示
deb-src http://archive.cloudera.com/debian xenial-cdh3 contrib
执行下面的命令:
- $ curl -s http://archive.cloudera.com/debian/archive.key | sudo apt-key add -
- 上面已经完成了库的添加,下面就可以安装了
- 更新apt包的索引
- $ sudo apt-get update
- 我们要安装hadoop,所以搜索下有哪些可用的版本
- apt-cache search hadoop
- 安装hadoop-0.20
- sudo apt-get install hadoop-0.20
- 安装完成后,接下来配置一下hadoop的伪分布式模式
- 在这个路径下/etc/hadoop-0.20/conf.pseudo,如果不知道自己的路径在哪儿,可以用下面语句(不太理解这个的作用,参考了别人的博客,这样试了一下)
(1) 安装pseudo
sudo apt-get install hadoop-0.20-conf-pseudo
(2)View how the hadoop-0.20-conf-pseudo packages changes your system.
To view the files on Ubuntu systems:$ dpkg -L hadoop-0.20-conf-pseudo
(1)core-site.xml :
<configuration> |
<property> |
<name>fs.default.name</name> |
<value>hdfs://localhost:9000</value> |
</property> |
</configuration> |
(2)hdfs-site.xml :
<configuration> |
<property> |
<name>dfs.replication</name> |
<value>1</value> |
</property> |
</configuration> |
(3)mapred-site.xml :
<configuration> |
<property> |
<name>mapred.job.tracker</name> |
<value>localhost:9001</value> |
</property> |
</configuration> |
(4)hadoop-env.sh文件,指定一下JAVA_HOME的值。
export JAVA_HOME=/home/liuyus/jdk1.8
export HADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_NAMENODE_OPTS"
export HADOOP_SECONDARYNAMENODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_SECONDARYNAMENODE_OPTS"
export HADOOP_DATANODE_OPTS="-Dcom.sun.management.jmxremote $HADOOP_DATANODE_OPTS"
export HADOOP_BALANCER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_BALANCER_OPTS"
export HADOOP_JOBTRACKER_OPTS="-Dcom.sun.management.jmxremote $HADOOP_JOBTRACKER_OPTS"
因为遇到了权限不够的问题,还在其中加了下面的语句,不过好像也没起到什么作用
export HADOOP_NAMENODE_USER="liuyus"
export HADOOP_SECONDARYNAMENODE_USER="liuyus"
export HADOOP_JOBTRACKER_USER="liuyus"export HADOOP_DATANODE_USER="liuyus"
export HADOOP_TASKTRACKER_USER="liuyus"
路径/usr/lib/hadoop-0.20/bin下,启动hadoop ./start-dfs.sh
又遇到了权限不够,localhost无法登录的问题,最后stop在start试了很多次之后,终于出来了这个界面
感觉还有哪里没弄对,继续学习吧…………
参考博客:http://zzw0309452.iteye.com/blog/1484559
https://blog.csdn.net/linhx/article/details/7582416?utm_source=tuicool