Linux Centos系统管理操作

Linux Centos系统管理操作

1. 查看当前服务器主机名称

[root@CDH01 ~]# hostname
//修改主机名
[root@CDH01 ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CDH01
//并重启设备,重启后,查看主机名,已经修改成功

2. 修改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

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

在这里插入图片描述

chkconfig 设置后台服务的自启配置

//语法
chkconfig   			 (功能描述:查看所有服务器自启配置)
chkconfig 服务名 off   (功能描述:关掉指定服务的自动启动)
chkconfig 服务名 on   (功能描述:开启指定服务的自动启动)
chkconfig 服务名 --list	(功能描述:查看服务开机启动状态)
`(1)关闭iptables服务的自动启动`
chkconfig iptables off
`(2)开启iptables服务的自动启动`
chkconfig iptables on

1. 临时关闭防火墙

`(1)查看防火墙状态`
[root@hadoop100桌面]# service iptables status
`(2)临时关闭防火墙`
[root@hadoop100桌面]# service iptables stop

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

在这里插入图片描述

[root@CDH02 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

在这里插入图片描述
修改配置

`修改主机名称`
vi /etc/sysconfig/network
`修改映射`
vim /etc/hosts
`重新启动服务器`
reboot

猜你喜欢

转载自blog.csdn.net/bx1215/article/details/107982227