在 CentOS Minimal 系统中,启动服务通常需要使用 systemctl
命令。以下是一些基本步骤和示例,帮助你在 CentOS Minimal 中启动服务:
列出所有服务:
systemctl list-units --type=service
启动特定服务:
sudo systemctl start <service_name>
例如,启动 SSH 服务:
sudo systemctl start sshd
停止特定服务:
sudo systemctl stop <service_name>
例如,停止 SSH 服务:
sudo systemctl stop sshd
重启特定服务:
sudo systemctl restart <service_name>
例如,重启 SSH 服务:
sudo systemctl restart sshd
查看服务状态:
sudo systemctl status <service_name>
例如,查看 SSH 服务状态:
sudo systemctl status sshd
启用服务开机自启动:
sudo systemctl enable <service_name>
例如,启用 SSH 服务开机自启动:
sudo systemctl enable sshd
禁用服务开机自启动:
sudo systemctl disable <service_name>
例如,禁用 SSH 服务开机自启动:
sudo systemctl disable sshd
SSH 服务:
sudo systemctl start sshd
sudo systemctl enable sshd
sudo systemctl status sshd
HTTP 服务(Apache):
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
MySQL 服务:
sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo systemctl status mysqld
防火墙服务(Firewalld):
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl status firewalld
sudo
命令。journalctl
命令查看日志,以获取更多信息:sudo journalctl -u <service_name>
通过这些步骤,你应该能够在 CentOS Minimal 系统中有效地管理服务。