用centOS安装Hadoop
时间: 2024-05-26 13:06:06 浏览: 118
在CentOS上安装Hadoop需要进行以下步骤:
1.创建hadoop用户
```shell
sudo addgroup hadoop
sudo adduser -g hadoop hadoop
sudo passwd hadoop
```
2.安装Java
```shell
sudo yum install java-1.8.0-openjdk-devel
```
3.下载Hadoop
```shell
wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz
```
4.解压Hadoop
```shell
tar -xzvf hadoop-3.3.1.tar.gz
```
5.配置环境变量
```shell
export HADOOP_HOME=/path/to/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
```
6.配置Hadoop
```shell
cd /path/to/hadoop/etc/hadoop
cp mapred-site.xml.template mapred-site.xml
cp core-site.xml.template core-site.xml
cp hdfs-site.xml.template hdfs-site.xml
```
7.修改配置文件
```shell
vi core-site.xml
```
在文件中添加以下内容:
```xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
```
```shell
vi hdfs-site.xml
```
在文件中添加以下内容:
```xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
```
8.格式化Hadoop文件系统
```shell
hdfs namenode -format
```
9.启动Hadoop
```shell
start-all.sh
```
阅读全文