温馨提示×

centos minimal怎样远程连接

小樊
40
2026-10-11 15:59:05
栏目: 智能运维

在 CentOS Minimal(最小安装版)下,默认通常没有图形界面,也不自带远程桌面,一般通过 SSH 远程命令行 来连接。下面从最常见到可选方案给你说明。


一、最常用:SSH 远程连接(推荐)

1️⃣ 确认 SSH 服务是否安装

CentOS Minimal 有时没装 openssh-server:

rpm -qa | grep openssh-server

如果没有,安装:

sudo yum install -y openssh-server

2️⃣ 启动并设置开机自启

sudo systemctl start sshd
sudo systemctl enable sshd

检查状态:

systemctl status sshd

3️⃣ 查看服务器 IP

ip addr

或

hostname -I

4️⃣ 防火墙放行 22 端口(如果有 firewalld)

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload

5️⃣ 从客户端连接

  • Linux / macOS
ssh user@服务器IP
  • Windows
    • 使用 PowerShell
      ssh user@服务器IP
      
    • 或用 PuTTY / Xshell / FinalShell

二、如果 SSH 连不上常见问题

✅ 检查端口

ss -tunlp | grep ssh

✅ 确认网络可达

ping 服务器IP

✅ 云服务器

  • 安全组必须放行 22 端口

三、想要图形界面远程(不推荐 Minimal)

CentOS Minimal 默认无桌面,需要额外安装:

方案 1:VNC

yum groupinstall "GNOME Desktop"
yum install tigervnc-server

方案 2:XRDP(Windows 远程桌面)

yum install epel-release
yum install xrdp
systemctl start xrdp

⚠️ 但 Minimal 不推荐图形远程,占用资源大,安全性低。


四、推荐做法总结

✅ CentOS Minimal 最佳远程方式:

SSH + 命令行管理

✅ 工具推荐:

  • Windows:Xshell / FinalShell / PuTTY
  • Mac/Linux:终端自带 ssh

如果你告诉我:

  • 是 物理机 / 虚拟机 / 云服务器
  • 用的是 CentOS 7 还是 8/Stream
  • 是否必须用 图形界面

我可以给你更精确的步骤。

0 踩