# hostname
# uname -n
# cat /proc/sys/kernel/hostname
修改为Hadoop100
vi 编辑器打开vi /etc/hosts 文件
在文件尾部添加内容,格式:IP地址 主机名(中间用空格分隔),保存退出
192.168.1.100 hadoop
systemctl restart network
[root@localhost ~]# ping hadoop100
PINGhadoop100 (192.168.1.100) 56(84) bytes of data.
64 bytesfrom hadoop100 (192.168.1.100): icmp_seq=1 ttl=64 time=0.038 ms
64 bytesfrom hadoop100 (192.168.1.100): icmp_seq=2 ttl=64 time=0.037 ms
64 bytesfrom hadoop100 (192.168.1.100): icmp_seq=3 ttl=64 time=0.038 ms
64 bytesfrom hadoop100 (192.168.1.100): icmp_seq=4 ttl=64 time=0.038 ms
如果想在我们的Windows是上用别名访问需要在C:\Windows\System32\drivers\etc\hosts后追加
192.168.1.100 hadoop100
[root@hadoop100 ~]# useradd shaozhiqi //添加用户
useradd: user 'shaozhiqi' already exists
[root@hadoop100 ~]# userdel shaozhiqi
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Creating mailbox file: File exists
[root@hadoop100 ~]# userdel -r shaozhiqi //删除用户及目录
[root@hadoop100 ~]# passwd shaozhiqi
Changing password for user shaozhiqi.
New password:
BAD PASSWORD: The password contains the user name in some form
Retype new password:
passwd: all authentication tokens updated successfully.
[root@hadoop100 ~]# id shaozhiqi //查看用户创建成功
uid=1000(shaozhiqi) gid=1000(shaozhiqi) groups=1000(shaozhiqi)
[root@hadoop100 ~]#
[root@hadoop100 ~]# vim /etc/sudoers
set nu 可以设置行号
:wq! 强制退出
[root@hadoop100~]# cd /opt
[root@hadoop100opt]# ll
total 0
drwxr-xr-x.2 root root 6 Mar 26 2015 rh
[root@hadoop100opt]# mkdir software module
[root@hadoop100opt]# ll
total 0
drwxr-xr-x.2 root root 6 Jun 18 05:58 module
drwxr-xr-x.2 root root 6 Mar 26 2015 rh
drwxr-xr-x.2 root root 6 Jun 18 05:58 software
[root@hadoop100opt]# rm -rf rh
[root@hadoop100opt]# ll
total 0
drwxr-xr-x.2 root root 6 Jun 18 05:58 module
drwxr-xr-x.2 root root 6 Jun 18 05:58 software
[root@hadoop100opt]# chown shaozhiqi:shaozhiqi module/ software/ //修改文件所有者
[root@hadoop100opt]# ll
total 0
drwxr-xr-x.2 shaozhiqi shaozhiqi 6 Jun 18 05:58 module
drwxr-xr-x.2 shaozhiqi shaozhiqi 6 Jun 18 05:58 software
在虚拟机关闭的情况下进行克隆
创建完整克隆不要快捷方式
52:54:00:0a:b6:9e
cd /etc/udev/rules.d
vi 70-persistent-ipoib.rules
运行命令:grub2-mkconfig -o /boot/grub2/grub.cfg #重新生成grub配置并更新内核参数
vi /etc/sysconfig/network-scripts/ifcfg-eth0
MACADDR=52:54:00:0a:b6:9e
service network restart 重启网卡
还是异常,于是修改
重启解决
1.修改mac为生成的mac
cd /etc/udev/rules.d
vi 70-persistent-ipoib.rules
2.修改vi
/etc/sysconfig/network-scripts/ifcfg-eth0里的HWADDR与其一致
3.修改ip
4.修改映射关系
vi /etc/hosts
5.修改机器名
vi /etc/hostname
6.重启网卡
service network restart
7.ping 机器名验证
8.重启机器可以看到机器名已变更
转载于:https://www.cnblogs.com/shaozhiqi/p/11534573.html