System Service Manager Directives
systemctl command is a system service manager command, which actually combines the two commands service and chkconfig.
Tasks | Old Commands | New Commands |
---|---|---|
Make a service start automatically | chkconfig --level 3 httpd on | systemctl enable httpd.service |
Prevent a service from starting automatically | chkconfig --level 3 httpd off | systemctl disable httpd.service |
Check service status | service httpd status | systemctl status httpd.service (service details) systemctl is-active httpd.service (only shows whether Active) |
Show all started services | chkconfig --list | systemctl list-units --type=service |
Start service | service httpd start | systemctl start httpd.service |
Stop service | service httpd stop | systemctl stop httpd.service |
Restart service | service httpd restart | systemctl restart httpd.service |
Reload service | service httpd reload | systemctl reload httpd.service |
systemctl start nfs-server.service . # Start nfs service
systemctl enable nfs-server.service # Set up auto-start at boot
systemctl disable nfs-server.service # Stop auto-start at boot
systemctl status nfs-server.service # View the current status of the service
systemctl restart nfs-server.service # Restart a service
systemctl list-units --type=service # View all started services
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 SELINUX=""
in the /etc/selinux/config
file to disabled, and then restart.
Turn off the firewall completely:
sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service