sudo apt-get update
sudo apt-get install vim
sudo apt-get install net-tools
自ubuntu17.10开始,已经放弃在/etc/network/interfaces里修改固定的IP配置,及时配置也不会生效,而是改成netplan方式,配置写在/etc/netplan/01-network-manager-all.yaml里面。
network:
version: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: no
addresses: [192.168.0.20/24]
gateway4: 192.168.0.1
nameservers:
addresses: [114.114.114.144, 8.8.8.8]
注意: gateway4的地址没有括号,修改后重启网络服务就正常了,重启命令为
netplan apply
国内有很多ubuntu的镜像源,包括阿里的、网易的、清华的、中科大的。
编辑/etc/apt/sources.list文件
保险方法,先备份
sudo cp sources.list source.list.bake
接下来编辑source.list文件
sudo vim source.list
删除文件中原有内容,复制一下内容到source.list文件中
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
修改结束之后,保存文件,执行以下命令
sudo apt-get update
sudo apt-get upgrade
更新源,安装openssh,方便通过putty或者xshell远程连接
sudo apt-get update
sudo apt-get install openssh-server
sudo apt-get install openssh-client
启动ssh服务
sudo service ssh restart
或
sudo /etc/init.d/ssh restart
验证ssh服务是否启动
sudo ps -ef | grep ssh
permission deny主要是写入的文件夹权限不足,将写入方文件夹权限改为755或者777
sudo chmod 777 /home/ubuntu/Software
解压jdk下载包
tar -zxvf jdk-8u241-linux-x64.tar.gz
移动jdk1.8.0_241文件夹到/usr/local文件夹下
sudo mv jdk1.8.0_241 /usr/local
文件夹重命名为jdk1.8
cd /usr/local
sudo mv jdk1.8.0_241 jdk1.8
环境配置统一放在/etc/profile文件中
sudo vim /etc/profile
在文档末尾输入
export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOMe/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
使配置文件有效,这步不能少
source /etc/profile
检验是否配置成功
java -version
sudo useradd -m hadoop -s /bin/bash
sudo passwd hadoop
sudo adduser hadoop sudo
修改 /etc/hostname 文件,每个节点都需要修改
主节点修改为:Master
从节点依次修改为:Slave01、Slave02
编辑 /etc/hosts 文件,在文件中添加如下关系:
192.168.0.20 Master
192.168.0.21 Slave01
192.168.0.22 Slave02
192.168.0.23 Slave03
下载好文件,并移动到/usr/local下
tar -zxvf zookeeper-3.4.13.tar.gz
sudo mv zookeeper-3.4.13 /usr/local
cd /usr/local
sudo mv zookeeper-3.4.13 zookeeper3.4
设置环境变量
sudo vim /etc/profile
在末尾添加如下内容
export ZOOKEEPER_HOME=/usr/local/zookeeper3.4
export PATH=$PATH:$ZOOKEEPER_HOME/bin
更新环境变量
source /etc/profile
配置环境变量时,最好加一个ZOO_HOME的变量
export ZOO_HOME=/usr/local/zookeeper3.4
修改配置,zookeeper的配置文件在/conf文件夹下,复制zoo_sample.cfg为zoo.cfg
cp -r zoo_sample.cfg zoo.cfg
配置如下:
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/home/ubuntu/Data/zookeeper/data
dataLogDir=/home/ubuntu/Data/zookeeper/logs
server.1=Master:2888:3888
server.2=Salve01:2888:3888
server.3=Slave02:2888:3888
clientPort=2183
admin.serverPort=8089