一、安装远程环境
1. 安装Remote-SSH
2. 选择Remote-ssh连接
选择Connect to Host
输入需要连接的IP选择linux版本 输入用户密码
即可完成VSCODE与linux的版本连接
异常:
1. 提示 Failed to connect to the remote extension host server(Error: WebSocket close with status code 1006)
首先,检查远程服务器上的 /etc/ssh/sshd_config里,有没有允许端口转发:AllowTcpForwarding yes
更改后,重启 sshd服务:systemctl restart sshd。
然后,删除~/.vscode-server目录
本地Vscode settings的user配置里,把remote.SSH.remoteServerListenOnSocket的勾去掉(因为remote配置那里这个remoteServerListenOnSocket是关掉的),Remote: Auto Forward Ports前面的勾确认是打开的。成功连接上以后,本地和远程服务器的remote.SSH.remoteServerListenOnSocket的勾会自动打开。