1、准备虚拟机
2、如果是克隆的虚拟机需要修改为静态IP
(1)命令: vim /etc/sysconfig/network-scripts/ifcfg-eth0
① 修改 HWADDR = 其中 以AA:BB:CC:DD:EE:FF形式的以太网设备硬件地址,如果不是克隆的,不需要改。
修改的命令: vim /etc/udev/rules.d/70-persistent-net.rules
复制 ATTR{address}== 想对应的值,
②ONBOOT = no 指明在系统启动时是否激活网卡 ,由 no 改为 yes。
③BOOTPROTO = none 指网络配置参数 ,有三种方式模式分别为 none(不指定)、static(静态IP)、dhcp(动态IP),我这里是改为static模式。
3、修改主机名
命令: vim /etc/sysconfig/network
修改自己对应的名字,我这里名字为hadoop102, 如HOSTNAME=hadoop102
4、关闭防火墙相关常用命令
(1):查看防火状态
systemctl status firewalld
service iptables status
(2):暂时关闭防火墙
systemctl stop firewalld
service iptables stop
(3):永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
(4):重启防火墙
systemctl enable firewalld
service iptables restart
(5):永久关闭后重启
//暂时还没有试过
chkconfig iptables on
5、创建 username 用户,命令如下
useradd username
passwd username(输入自己容易记住的密码)
6、配置 username 用户具有 root 权限
(1)、修改sudoers文件为可修改状态,命令如下
chmod -v u+w /etc/sudoers
(2)、修改sudoers文件,新增一行指令,使新用户有root一样的权限,命令如下
vim /etc/sudoers
找到 root ALL=(ALL)ALL
在下面添加 username ALL=(ALL)ALL
然后,保存退出即可!
(3)、上面我们修改sudoers文件为可修改,此时我们应该重新把它修改为只读模式:
执行如下命令:
chmod -v u-w /etc/sudoers
7、在/opt目录下创建文件夹
(1)在/opt目录下创建module、software文件夹,software存放的是 zip 压缩文件,module 存放解压文件,命令如下
sudo mkdir module
sudo mkdir module
(2)修改module、software文件夹的所有者 cd, 命令如下
sudo chown username:username module/
sudo chown username:username software/
8、本地windows 和虚拟机互 ping IP 的配置
在 C:\Windows\System32\drivers\etc 中的 hosts 中添加虚拟机IP 地址和hosts名。