Linux server, service management --systemctl Detailed command, set the boot from the start
syetemclt is the integration of service and chkconfig these two commands, the CentOS 7 began to be used.
Abstract: systemctl Service Manager is a system command, it is actually a combination of service and chkconfig these two commands together.
task | Old instructions | The new directive |
Make a service to start automatically | chkconfig --level 3 httpd on | systemctl enable httpd.service |
So that a service does not start automatically | chkconfig --level 3 httpd off | systemctl disable httpd.service |
Check the service status | service httpd status | systemctl status httpd.service (service details) systemctl is-active httpd.service (display only if Active) |
It shows all the services started | chkconfig --list | systemctl list-units --type=service |
Start a Service | service httpd start | systemctl start httpd.service |
Stop a service | service httpd stop | systemctl stop httpd.service |
Restart a service | service httpd restart | systemctl restart httpd.service |
Below nfs service, for example:
1. Start the nfs service
systemctl start nfs-server.service
2. Set the boot from the start
systemctl enable nfs-server.service
3. Stop the boot from the start
systemctl disable nfs-server.service
4. Review the current state of service
systemctl status nfs-server.service
5. Restart a Service
systemctl restart nfs-server.service
6. Check all started service
systemctl list -units --type=service
22 open firewall ports
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
If the problem persists, it could be due to SELinux
Close SElinux:
Modify / etc / selinux / config file SELINUX = "" to disabled, the restart and then
Completely turn off the firewall:
sudo systemctl status firewalld.service sudo systemctl stop firewalld.service sudo systemctl disable firewalld.service