Skip to main content

Docker Image

Ubuntu

系统版本是 20.04

apt update
apt install nano sudo openssh-server

换阿里源

nano /etc/apt/sources.list

将下面内容写入

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
apt clean
apt update

添加 hadoop 用户(略过)

之后会有一些个人信息提醒

adduser hadoop

进入 /etc/sudoers,在 root 的下方添加一行,这样 hadoop 用户就可以用 sudo 了。

nano /etc/sudoers
root    ALL=(ALL:ALL) ALL
hadoop ALL=(ALL:ALL) ALL

开启 ssh

apt install openssh-server

/etc/init.d/ssh restart

修改配置文件,使 root 也能登陆

nano /etc/ssh/sshd_config

注释这一行 PermitRootLogin prohibit-password 添加一行 PermitRootLogin yes

# PermitRootLogin prohibit-password
PermitRootLogin yes

配置免密登陆

# 若没有该目录,请先执行一次ssh localhost
cd ~/.ssh/

# 会有提示,都按回车就可以
ssh-keygen -t rsa

# 加入授权
cat ./id_rsa.pub >> ./authorized_keys

安装 Java 环境 和 Hadoop 3.1.3

林子雨 Hadoop3.1.3安装教程 单机/伪分布式配置

其中的一些意外

Hadoop分布式启动报错ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.