1. Service management
settings Service (service) start and close
systemctl enable/disable service
set service start/restart/shutdown
systemctl start/restart/stop service
2. Firewall (firewalld) start and close
firewall
systemctl enable firewalld
firewall close boot and start
systemctl disable firewalld
set firewall to start/restart/close
systemctl start/restart/stop firewalld
3.selinux setting and viewing and modifying operating mode
settings
vi /etc/selinux/config
find SELINUX=enforcing this line
can be modified For the following three modes
SELINUX=enforcing mandatory mode (default)
SELINUX=permissive permissive mode (with warnings)
SELINUX=disabled turn off
view
getenforce
modify run mode
setenforce 0|1
0 permissive
1 disabled
systemctl is a system service manager command that actually combines the two commands service and chkconfig.
Task old command new command
Make a service start automatically chkconfig –level 3 httpd on systemctl enable httpd.service
make a service not start 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 it is Active)
shows all started services 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
restarts a service service httpd restart systemctl restart httpd.service
makes a service completely unable to start (added to the blacklist) systemctl umask httpd.service
Remove from blacklist systemctl mask httpd.service
List dependent services of a service systemctl list-dependencies sshd.service
List all active services systemctl list-units --type=service
List all services including inactive services systemctl list- units --type=service --all
lists whether all services start automatically at boot systemctl list-unit-files --type=service
lists the services that failed to start systemctl --failed --type=service
The following takes the nfs service as an example:
1. Start the nfs service
systemctl start nfs-server.service
2. Set the
systemctl enable nfs-server.service
from the boot system 3. Stop the self-start
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 22 port
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
If there is still a problem, it may be caused by SELinux
Turn off SElinux:
modify the /etc/selinux/config file SELINUX=”” is disabled, then restart
Completely turn off the firewall:
sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
centos7 service management, firewall and selinux setup
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326673632&siteId=291194637
Ranking