在Ubuntu上安装Hadoop的步骤如下:
sudo apt install net-tools vim
sudo ufw disable
hostnamectl set-hostname master
cat >> /etc/hosts << eof
192.168.52.28 master
eof
ssh-keygen -t rsa -p ""
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
tar -xzf jdk-8u201-linux-x64.tar.gz -c /usr/local/
cd /usr/local/
mv jdk1.8.0_201 java
vi /etc/profile
export JAVA_HOME=/usr/local/java
export path=$path:$java_home/bin:$java_home/sbin
source /etc/profile
java -version
http://archive.apache.org/dist/hadoop/core/hadoop-2.7.6/hadoop-2.7.6.tar.gz
tar -xzf hadoop-2.7.6.tar.gz -c /usr/local/
cd /usr/local/hadoop-2.7.6/etc/hadoop/
mkdir /data/hadoop/hdfs/tmp
mkdir /data/hadoop/hdfs/name
mkdir /data/hadoop/hdfs/data
hadoop-env.sh
文件:vim hadoop-env.sh
添加以下行:
export JAVA_HOME=/usr/local/java
start-dfs.sh
和stop-dfs.sh
文件:vim start-dfs.sh
vim stop-dfs.sh
添加以下行:
hdfs_datanode_user=roothadoop_secure_dn_user=hdfshdfs_namenode_user=roothdfs_secondarynamenode_user=root
start-yarn.sh
和stop-yarn.sh
文件:vim start-yarn.sh
vim stop-yarn.sh
添加以下行:
yarn_resourcemanager_user=roothadoop_secure_dn_user=yarnyarn_nodemanager_user=root
core-site.xml
文件:cd /usr/local/hadoop-2.7.6/etc/hadoop/
vim core-site.xml
添加以下内容:
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/data/hadoop/hdfs/tmp</value>
</property>
<property>
<name>fs.defaultfs</name>
<value>hdfs://master:9000</value>
</property>
</configuration>
hdfs-site.xml
文件:vim hdfs-site.xml
添加以下内容:
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/data/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/data/hadoop/hdfs/data</value>
</property>
</configuration>
mapred-site.xml
文件:cp mapred-site.xml.template mapred-site.xml
vim mapred-site.xml
添加以下内容:
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
以上步骤涵盖了在Ubuntu上安装Hadoop的基本流程,包括系统初始化、Java环境安装、Hadoop环境搭建等关键步骤。