头图
This week, I wrote and read the source code and design pattern of the thread pool, but I think I still have a few middlewares to learn, so I plan to build this Linux service environment first. Later, we will build clusters and big data using this environment.

Install Linux first

My machine is windows, so I need a Vm Ware, please refer to the installation tutorial: https://zhuanlan.zhihu.com/p/272541376 . This tutorial is very detailed. Next we need an image of the operating system, search for Centos in the search engine

Centos地址

x86

下载镜像

Centos下载

新建虚拟机

选择自定义

下一步

稍后安装操作系统

选Linux

选64位

搭建集群

选择下一步

给两个G

选NAT

LSI Logic

磁盘选择

创建虚拟磁盘

下一步 下一步

下一步-下一步

装好了

点这里

加载镜像

加载ISO镜像

选中iso文件

开启虚拟机

Just go in and choose the first one.

选中文

选GNOME桌面

选择硬盘分区

选择手工分区

点完成

选择标准分区

挂载分区

挂载10G

启动盘给300M

swap=2048

内存配置完成

分区完成

分区设计完成

设置root密码

等他装完

重启

点击完成配置

完成配置

Then click Next, go to the time zone and select Shanghai. To set the username, we enter bigdata01.

切换root用户登录

点这里切换用户

打开终端

Lay out the network

  • Enter the command hostname in the terminal to view the host name
  • set hostname: hostnamectl set-hostname bigdata01
  • The gateway is uniformly set to 192.168.2.1, and the cluster is built later, and the assigned IP is

    • 192.168.2.128 bigdata01
    • 192.168.2.129 bigdata02
    • 192.168.2.130 bigdata03
  • Enter halt in the terminal to shut down
  • 虚拟机网络编辑器更改配置
  • NAT模式设置子网

    点NAT设置网关设置为DHCP设置

128

Then enter the Linux terminal, let's configure the network.

 cd  /etc/sysconfig/network-scripts/ 
vi ifcfg-ens33
将BOOTPROTO改为static
ONBOOT由no改为yes
新加配置
IPADDR=192.168.2.128
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114.114
DNS2=8.8.8.8
vi /etc/hosts 改下主机名 追加配置 192.168.2.128 bigdata01
service NetworkManager stop
/etc/init.d/network restart
chkconfig NetworkManager off
vi /etc/resolv.conf 追加 nameserver=192.168.2.1
systemctl restart network
然后ping www.baidu.com 这台虚拟机就能连互联网了
然后就可以通过XShell 连接虚拟机了

Install the necessary software on the server

 # 时间同步
yum -y install npt  ntpdate
ntpdate cn.pool.ntp.org
hwclock --systoch
yum install lrzsz
wget https://repo.huaweicloud.com/java/jdk/8u151-b12/jdk-8u151-linux-x64.rpm
rpm -ivh jdk-8u151-linux-x64.rpm
# 配置环境变量
vi /etc/profile
# 追加下面这样
export JAVA_HOME=/usr/java/jdk1.8.0_151
export CLASSPATH=$JAVA_HOMT\lib:$CLASSPATH
export PATH=$JAVA_HOME\bin:$PATH
source /etc/profile

What about the good group? It's too troublesome to have to do this once for each one, isn't it? VM Ware has a copy function, we can copy it. Shut down before copying.

克隆

完整克隆

Then select the file storage location. The cloned one also needs to change the network configuration, hostname, and domain name mapping. The command is as follows:

 # 设置hostname: 
hostnamectl set-hostname bigdata01
cd  /etc/sysconfig/network-scripts/ 
vi ifcfg-ens33
将BOOTPROTO改为static
ONBOOT由no改为yes
新加配置
IPADDR=192.168.2.128
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114.114
DNS2=8.8.8.8
vi /etc/hosts 改下主机名 追加配置 192.168.2.128 bigdata01  192.168.2.129 bigdata02
# 记得bigdata01的主机也加下映射
service NetworkManager stop
/etc/init.d/network restart
chkconfig NetworkManager off
vi /etc/resolv.conf 追加 nameserver=192.168.2.1
systemctl restart network
然后这台虚拟机就能连互联网了
然后就可以通过XShell 连接虚拟机了

At this point, our cluster is basically set up.


北冥有只鱼
147 声望35 粉丝