在CentOS环境下使用PHPStorm的SSH隧道,可参考以下步骤:
sudo yum install openssh-server
命令安装。启动并启用SSH服务,sudo systemctl start sshd
和sudo systemctl enable sshd
。配置防火墙允许SSH连接,sudo firewall-cmd --permanent --add-service=ssh
,然后sudo firewall-cmd --reload
。ssh-keygen -t rsa
,将公钥~/.ssh/id_rsa.pub
复制到远程服务器的~/.ssh/authorized_keys
文件中,可使用ssh-copy-id username@server_ip
命令。File > Settings
(Windows/Linux)或PHPStorm > Preferences
(Mac)。选择Tools > SSH Configurations
,点击+
添加新的SSH配置,填写服务器地址、端口、用户名,选择认证方式(密码或密钥对),若用密钥对则指定私钥文件路径。Test Connection
按钮,若显示连接成功,则说明SSH隧道配置正确。