用户本地安装code-server

github的code-server上的安装方式会安装到系统路径

mkdir -p ~/tools
cd ~/tools

wget https://github.com/coder/code-server/releases/download/v4.98.2/code-server-4.98.2-linux-amd64.tar.gz
tar -xvzf code-server-4.98.2-linux-amd64.tar.gz
mv code-server-4.98.2-linux-amd64 code-server

然后添加环境变量到~./bashrc

export PATH=$HOME/tools/code-server/bin:$PATH

然后执行:

source ~/.bashrc

启动 code-server
简单启动:

code-server

指定端口、禁用密码认证(方便本地 ssh 隧道后访问):

code-server --bind-addr 127.0.0.1:8888 --auth none

本地访问
在你本地电脑运行(端口取决于code-server启动提示,也可在~.config/code-server/config.yaml配置):

ssh -L 8888:localhost:8888 YOUR_NUS_USER@xlogin.comp.nus.edu.sg

然后浏览器打开 http://localhost:8888