Linux命令——系统管理操作
1.查看、修改虚拟机的网络配置
【1】查看ip地址
ifconfig
【2】修改ip地址
vim /etc/sysconfig/network-scripts/ifcfg-eth0
【3】网络连通测试
ping
2.配置主机名
【1】查看主机名
hostname
【2】修改Linux的主机名
vim /etc/sysconfig/network
注意: 主机名称不要有“_”下划线
【3】修改window 10 的主机映射文件
a)进入C:\Windows\System32\drivers\etc路径
b)打开hosts文件并添加如下内容
192.168.1.3 hadoop003
192.168.1.4 hadoop004
192.168.1.5 hadoop005
【4】修改吸泥机hosts文件
打开 /etc/hosts
[root@hadoop001 桌面]# vim /etc/hosts
添加如下内容
10.10.54.101 hadoop001
10.10.54.102 hadoop002
10.10.54.103 hadoop003
修改后可以直接ping主机名
3.防火墙
【1】查看防火墙
service iptables status
【2】查看防火墙开机启动状态
chkconfig iptables --list
【3】临时关闭防火墙
[root@hadoop001 桌面]# service iptables stop
【4】关闭防火墙开机启动
chkconfig iptables off
【5】开启防火墙开机启动
chkconfig iptables on
我们现在用不到防火墙,一定要将其关闭
chkconfig iptables off,然后重启
4.关闭重启
【1】正确的关机流程:
(1)基本语法:
a) sync
(功能描述:将数据由内存同步到硬盘中)
b) shutdown [选项] 时间
选项:
-h:关机
-r:重启
c) halt
(功能描述:关闭系统,等同于shutdown -h now 和 poweroff)
d) reboot
(功能描述:就是重启,等同于 shutdown -r now)