温馨提示×

centos如何远程phpstorm

小樊
48
2026-09-15 01:07:52
栏目: 编程语言

在 CentOS 上远程使用 PHPStorm(JetBrains IDE),常见有 三种方式,按使用场景选:


一、SSH 远程开发(最常用 ✅)

适合:代码在 CentOS 上,本地 Windows / macOS 用 PHPStorm 编辑

1️⃣ CentOS 开启 SSH

# 安装(一般已装)
yum install -y openssh-server

# 启动
systemctl start sshd
systemctl enable sshd

# 确认端口
firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload

2️⃣ PHPStorm 配置远程连接

  1. File → Settings → PHP → CLI Interpreter
  2. 点击 + → From Docker / SSH
  3. 选择 SSH
  4. 填写:
    • Host:CentOS IP
    • Port:22
    • User / Password 或 Key
  5. 测试连接 ✅

3️⃣ 映射项目目录

  • Tools → Deployment → Configuration
  • 添加 SFTP
  • 映射:
    • Local: 本地目录
    • Remote: /var/www/html/xxx

✅ 可自动上传 / 下载


二、PHPStorm 直接跑在 CentOS(不推荐)

适合:无本地电脑,服务器带桌面

1️⃣ 安装桌面(如有 GUI)

yum groupinstall "GNOME Desktop"

2️⃣ 安装 PHPStorm

# 下载
wget https://download.jetbrains.com/webide/PhpStorm-2023.3.tar.gz
tar -xzf PhpStorm-*.tar.gz
cd PhpStorm-*/bin
./phpstorm.sh

⚠️ 服务器资源占用高,一般不用


三、远程桌面访问 CentOS(可选)

适合:必须图形界面

  • XRDP
  • VNC
  • NoMachine
yum install -y epel-release
yum install -y xrdp
systemctl start xrdp

推荐方案 ✅

✅ SSH + Deployment(最稳定、最专业)

如果你愿意,可以告诉我:

  • CentOS 版本(7 / 8 / Stream)
  • 本地系统(Win / Mac)
  • PHP 是否在 Docker 中

我可以给你 一步步截图级配置。

0 踩