运维开发网

CentOS7的基本配置

运维开发网 https://www.qedev.com 2020-10-30 12:17 出处:51CTO 作者:远方在呼唤
基本配置

1、修改主机名

[[email protected] ~]# cat /etc/hostname

localhost.localdomain

[[email protected] ~]# hostnamectl set-hostname server28.example.com

[[email protected] ~]# cat /etc/hostname

server28.example.com

注:在centos7中主机名的信息存储在/etc/hostname中,而不再是/etc/sysconfig/network

2、启动/关闭/重启/查看服务(systemctl start/stop/restart/status services)

[[email protected] ~]# systemctl start firewalld 启动防火墙

[[email protected] ~]# systemctl stop firewalld 关闭防火墙

[[email protected] ~]# systemctl restart firewalld 重启防火墙

[[email protected] ~]# systemctl status firewalld 查看防火墙状态

[[email protected] ~]# systemctl list-unit-files 查看系统所有服务的状态

3、设置服务的自启动

[[email protected] ~]# systemctl enable sshd 设置sshd开机自动

[[email protected] ~]# systemctl disable sshd 设置sshd不开机自启

4、进入紧急/图形/单用户/拯救模式

[[email protected] ~]# systemctl isolate

emergency.targer graphical.target multi-user.target rescue.target

5、关机/重启

[[email protected] ~]# systemctl halt 关机

[[email protected] ~]# systemctl reboot 重启

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号