Linux Centos系统管理操作(转载)

Linux Centos系统管理操作

  1. 查看当前服务器主机名称
    [root@CDH01 ~]# hostname
    //修改主机名
    [root@CDH01 ~]# vi /etc/sysconfig/network
    NETWORKING=yes
    HOSTNAME=CDH01
    //并重启设备,重启后,查看主机名,已经修改成功
    1
    2
    3
    4
    5
    6
  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
    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. 临时关闭防火墙

(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

原文链接:https://blog.csdn.net/bx1215/article/details/107982227?utm_medium=distribute.pc_feed.none-task-blog-personrec_tag-13.nonecase&depth_1-utm_source=distribute.pc_feed.none-task-blog-personrec_tag-13.nonecase&request_id=5f374da5df0ade63513246ce

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值