本机创建三个虚拟机,
Hostname |
Ip |
Name |
Password |
centos2 |
192.168.75.101 |
root |
root123 |
Centos3 |
192.168.75.102 |
root |
root123 |
Centos4 |
192.168.75.103 |
root |
root123 |
1. 修改hosts文件
修改三台机器的hosts文件:vi /etc/hosts
添加:
192.168.75.101 centos2
192.168.75.102 centos3
192.168.75.103 centos4
2. 关闭防火墙
(centos7)
每台机器上运行:
systemctl stop firewalld.service
systemctl disable firewalld.service
查看防火墙状态:
systemctl status firewalld.service
3. 关闭selinux
查看selinux状态:
/usr/sbin/sestatus -v
#如果SELinux status参数为enabled即为开启状态
关闭selinux
临时关闭(不用重启机器):
setenforce 0
永久关闭:
修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
vim /etc/selinux/config
改为:
重启后:
4. 禁用IPv6
#修改参数,禁用IPv6
vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
5. 优化最大打开文件数
查看两处关键点是否设置了优化
ulimit -a
#编辑配置文件,添加如下参数
vim /etc/security/limits.conf
在最后添加如下内容:
# End of file
* soft nofile 655350
* hard nofile 655350
* soft core unlimited
* hard core unlimited
* soft nproc 65536
* hard nproc 65536
重启机器:
6. ssh免密码登录
ssh-******
一路回车生成**。
然后将**复制到其他机器:
ssh-copy-id [email protected]
ssh-copy-id [email protected]
其他机器同样的操作。
7. 安装jdk
rpm -ivh jdk-8u11-linux-x64.rpm
环境变量如下: