Basic configuration of CentOS7

1. Modify the host name
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# hostnamectl set-hostname server28.example.com
[root@localhost ~]# cat /etc/hostname
server28. example.com
Note: The hostname information in centos7 is stored in /etc/hostname instead of /etc/sysconfig/network

2. Start/stop/restart/view services (systemctl start/stop/restart/status services)
[root@localhost ~]# systemctl start firewalld start firewall
[root@localhost ~]# systemctl stop firewalld close firewall
[root@localhost ~ ]# systemctl restart firewalld Restart firewall
[root@localhost ~]# systemctl status firewalld View firewall status
[root@localhost ~]# systemctl list-unit-files View the status of all services in the system
3. Set up the service start
[root@localhost ~]# systemctl enable sshd set sshd to start automatically
[root@localhost ~]# systemctl disable sshd set sshd not to start automatically

4. Enter emergency/graphics/single user/rescue mode
[root@localhost ~]# systemctl isolate
emergency.targer graphical.target multi-user.target rescue.target

5. Shut down/restart
[root@localhost ~]# systemctl halt shut down
[root@localhost ~]# systemctl reboot restart

Guess you like

Origin blog.51cto.com/11293100/2545005
Recommended