Code-Server
在云主机上运行VS Code,并通过浏览器在任意位置访问它。

安装
- 操作系统: Ubuntu 24.04
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb
sudo dpkg -i code-server_${VERSION}_amd64.deb
sudo systemctl enable --now code-server@$USER更新
sudo dpkg -i code-server_${VERSION}_amd64.deb
sudo systemctl restart code-server@$USER配置
~/.config/code-server/config.yaml:
bind-addr: <ip>:<port>
auth: password
hashed-password: "<the hashedpassword>"
cert: false
disable-telemetry: true
disable-workspace-trust: true
app-name: CodeServer其中hashed-password的生成方式如下:
sudo apt install argon2
echo -n "thisismypassword" | argon2 saltItWithSalt -e访问
将http://<ip>:<port>辅以nginx以https://domain-name的形式暴露出来。
- 在macOS, Windows上的Chrome浏览器中将其安装为PWA应用
- iPadOS上的Safari浏览器中将其安装为PWA应用
随时随地访问即可。
终端和主题
- 终端按照Terminal为code-server的部署主机Ubuntu 24.04设置好。
"workbench.colorTheme": "Default Dark Modern"
code-server内置终端的字体配置,在settings.json中:
{
"terminal.integrated.fontFamily": "'MesloLGS NF'",
"terminal.integrated.fontSize": 15,
}iPadOS上使用自定义字体
上面的终端方案在ipadOS上存在字体问题,解决这个问题参考了下面两个issue:
- https://github.com/coder/code-server/issues/1374
- https://github.com/tuanpham-dev/code-server-font-patch
最终在nginx上使用ngx_http_sub_module模块的sub_filter插入专门用于iPadOS的字体解决。nginx的配置示例如下:
location / {
proxy_pass http://<ip>:<port>;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# proxy_set_header Accept-Encoding gzip;
proxy_set_header Accept-Encoding "";
proxy_redirect off;
sub_filter
'workbench.web.main.css">'
'workbench.web.main.css">
<link rel="stylesheet" type="text/css" href="/ios-fonts/css/fonts.css">';
sub_filter_once on;
}
location /ios-fonts {
autoindex on;
alias /opt/code-server/ios-fonts;
}当前问题
- GitHub Copilot可和以通过下载vsix包离线安装
code-server --install-extension github.copilot-xx.xx.xx.vsix code-server --install-extension github.copilot-chat-xx.xx.xx.vsix - 当前AI Promgraming扩展平替为Roo Code(Roo Cline)