CentOS7的基本配置

一、修改主機名
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# hostnamectl set-hostname server28.example.com
[root@localhost ~]# cat /etc/hostname
server28.example.com
注:在centos7中主機名的信息存儲在/etc/hostname中,而再也不是/etc/sysconfig/network





centos

二、啓動/關閉/重啓/查看服務(systemctl start/stop/restart/status services)
[root@localhost ~]# systemctl start firewalld 啓動防火牆
[root@localhost ~]# systemctl stop firewalld 關閉防火牆
[root@localhost ~]# systemctl restart firewalld 重啓防火牆
[root@localhost ~]# systemctl status firewalld 查看防火牆狀態
[root@localhost ~]# systemctl list-unit-files 查看系統全部服務的狀態
三、設置服務的自啓動
[root@localhost ~]# systemctl enable sshd 設置sshd開機自動
[root@localhost ~]# systemctl disable sshd 設置sshd不開機自啓







dom

四、進入緊急/圖形/單用戶/拯救模式
[root@localhost ~]# systemctl isolate
emergency.targer graphical.target multi-user.target rescue.target

ssh

五、關機/重啓
[root@localhost ~]# systemctl halt 關機
[root@localhost ~]# systemctl reboot 重啓

ide

相關文章
相關標籤/搜索