温馨提示×

centos minimal怎么远程

小樊
40
2026-09-26 23:11:44
栏目: 智能运维

在 CentOS Minimal(最小化安装)环境下,默认通常没有图形界面,也没有开启远程桌面,一般通过 SSH 远程命令行 来管理。下面按常见需求说明。


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

1. 确认 SSH 已安装

CentOS Minimal 有时默认没装 openssh-server:

rpm -qa | grep openssh

如果没有,安装:

yum install -y openssh-server

2. 启动并设置开机自启

systemctl start sshd
systemctl enable sshd

3. 查看 IP

ip addr

或

hostname -I

4. 从另一台电脑连接

ssh 用户名@服务器IP

例如:

ssh root@192.168.1.100

⚠️ 注意:

  • CentOS 默认防火墙可能拦 22 端口
  • 云服务器需放行 安全组 22 端口

5. 开放防火墙(如有)

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

二、远程桌面(不推荐 Minimal 用)

CentOS Minimal 没有 GUI,如果要远程桌面:

方案 1:安装 GNOME + VNC

yum groupinstall -y "GNOME Desktop"
yum install -y tigervnc-server

然后配置 VNC(较复杂,不推荐服务器用)。

方案 2:Web 终端(轻量)

如安装 Cockpit:

yum install -y cockpit
systemctl enable --now cockpit.socket

浏览器访问:

https://IP:9090

三、文件远程传输

1. SCP(命令行)

scp file.txt user@ip:/path/

2. SFTP 工具

  • WinSCP
  • FileZilla

四、总结建议

需求 推荐方式
日常管理 ✅ SSH
文件传输 ✅ SCP / SFTP
图形界面 ❌ 不建议 Minimal
Web 管理 ✅ Cockpit

如果你告诉我:

  • 是 物理机 / 虚拟机 / 云服务器
  • 用的是 CentOS 7 还是 8/Stream

我可以给你更精确的命令。

0 踩