Introduction to common commands of systemctl~~~
Systemctl is a systemd tool mainly responsible for controlling the systemd system and service manager.
Systemd is a collection of system management daemons, tools, and libraries that replace the System V init process. The function of Systemd is to centrally manage and configure UNIX-like systems.
make a service start automatically | systemctl enable httpd.service | |
Make a service not start automatically | systemctl disable httpd.service | |
Check service status | systemctl status httpd.service (service details) systemctl is-active httpd.service (only shows if it is Active) |
|
show all started services | systemctl list-units --type=service | |
start a service | systemctl start httpd.service | |
stop a service | systemctl stop httpd.service | |
restart a service | systemctl restart httpd.service |
example
1. Start the nfs service
systemctl start nfs-server.service
2. Set the boot to start automatically
systemctl enable nfs-server.service
3. Stop booting from self-starting
systemctl disable nfs-server.service
4. View the current status of the service
systemctl status nfs-server.service
5. Restart a service
systemctl restart nfs-server.service
6. View all started services
systemctl list -units --type=service
Open firewall port 22
iptables -I INPUT -p tcp --dport 22 -j accept
If you still have problems, it may be caused by SELinux
Turn off SElinux:
Modify /etc/selinux/config
the file to SELINUX=””
be disabled, and then restart.
Turn off the firewall completely:
sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
Reference: http://man.linuxde.net/systemctl