Linux Centos系统管理操作
- 查看当前服务器主机名称
[root@CDH01 ~]# hostname
//修改主机名
[root@CDH01 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CDH01
//并重启设备,重启后,查看主机名,已经修改成功
1
2
3
4
5
6 - 修改linux的主机映射文件(hosts文件)
[root@CDH01 ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.201 CDH01
1
2
3
4
3.关闭防火墙
service 后台服务管理
语法
service 服务名 start (功能描述:开启服务)
service 服务名 stop (功能描述:关闭服务)
service 服务名 restart (功能描述:重新启动服务)
service 服务名 status (功能描述:查看服务状态)
(1)查看网络服务的状态
service network status
(2)停止网络服务
service network stop
(3)启动网络服务
service network start
(4)重启网络服务
service network restart
(5)查看系统中所有的后台服务
service --status-all
关闭seLinux
vim /etc/selinux/config
SELINUX=disabled
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
在这里插入图片描述
chkconfig 设置后台服务的自启配置
//语法
chkconfig (功能描述:查看所有服务器自启配置)
chkconfig 服务名 off (功能描述:关掉指定服务的自动启动)
chkconfig 服务名 on (功能描述:开启指定服务的自动启动)
chkconfig 服务名 --list (功能描述:查看服务开机启动状态)
(1)关闭iptables服务的自动启动
chkconfig iptables off
(2)开启iptables服务的自动启动
chkconfig iptables on
1
2
3
4
5
6
7
8
9
- 临时关闭防火墙
(1)查看防火墙状态
[root@hadoop100桌面]# service iptables status
(2)临时关闭防火墙
[root@hadoop100桌面]# service iptables stop
1
2
3
4
2.开机启动时关闭防火墙
(1)查看防火墙开机启动状态
chkconfig iptables --list
(2)设置开机时关闭防火墙
chkconfig iptables off
4.关机重启命令
1. 基本语法
(1)sync (功能描述:将数据由内存同步到硬盘中)
(2)halt (功能描述:关闭系统,等同于shutdown -h now 和 poweroff)
(3)reboot (功能描述:就是重启,等同于 shutdown -r now)
5.克隆虚拟机
关闭要被克隆的虚拟机
找到克隆选项
6.修改克隆后虚拟机的ip
[root@CDH02 ~]# vim /etc/udev/rules.d/70-persistent-net.rules
1
[root@CDH02 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
1
修改配置
修改主机名称
vi /etc/sysconfig/network
修改映射
vim /etc/hosts
重新启动服务器
reboot
本文详细介绍Linux CentOS系统的管理操作,包括查看与修改主机名、编辑主机映射文件、服务管理如开启、关闭、重启及状态查看,以及防火墙与SElinux的控制,最后讲解了系统重启与克隆虚拟机后的IP修改步骤。
746

被折叠的 条评论
为什么被折叠?



