在 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 系統中有效地管理服務。