在 CentOS Minimal 上安装软件,您可以使用 yum
或 dnf
包管理器
sudo yum update
或者,如果您使用的是 CentOS 8 或更高版本,可以使用 dnf
:
sudo dnf update
yum
或 dnf
命令来安装所需的软件包。例如,如果您想要安装 httpd
(Apache Web 服务器),请运行以下命令:对于 CentOS 7 及更低版本:
sudo yum install httpd
对于 CentOS 8 及更高版本:
sudo dnf install httpd
对于 CentOS 7 及更低版本:
sudo systemctl status httpd
对于 CentOS 8 及更高版本:
sudo systemctl status httpd.service
如果服务正在运行,您将看到类似于 “Active: active (running)” 的输出。
启动服务:
对于 CentOS 7 及更低版本:
sudo systemctl start httpd
对于 CentOS 8 及更高版本:
sudo systemctl start httpd.service
停止服务:
对于 CentOS 7 及更低版本:
sudo systemctl stop httpd
对于 CentOS 8 及更高版本:
sudo systemctl stop httpd.service
重启服务:
对于 CentOS 7 及更低版本:
sudo systemctl restart httpd
对于 CentOS 8 及更高版本:
sudo systemctl restart httpd.service
现在您已经在 CentOS Minimal 上成功安装了软件。如果您需要安装其他软件包,请重复上述步骤。