安装服务端
服务端(code-server)是一个单文件程序,负责提供 Web 界面并在浏览器和 Agent 之间转发流量。仅支持 Linux——最小配置的 VPS 就够用。
没有 VPS?用托管服务器
不想自己维护服务器,可以直接用公共的 16code 服务器:跳过本页,直接去安装 Agent,登录时选一个托管节点即可。
方式一:一行命令安装(推荐)
在 VPS 上以 root 执行:
bash
curl -fsSL https://16co.de/install_server.sh | sudo bash脚本会自动识别发行版下载对应的包(deb 或 rpm)、安装并启动 code-server systemd 服务。你会得到:
- 服务器以专用的非特权用户
code运行在 80/443 端口 - 开机自启(
systemctl enable),崩溃自动重启 - 配置在
/etc/code.yaml,数据在/var/lib/code
装完后用浏览器打开 http://<你的服务器IP>/,应该能看到登录页。然后配置域名和 HTTPS:HTTPS 与域名。
没有 root?用户态安装
同一个脚本不加 sudo 运行时,会完整安装到你的家目录下——不动包管理器、不占特权端口:
bash
curl -fsSL https://16co.de/install_server.sh | bash- 程序在
~/.local/bin/code-server,配置在~/.config/code/server.yaml,数据在~/.local/share/code - 默认监听 8080 端口(执行前设
CODE_PORT=9000可改) - 以
systemctl --user服务运行;脚本会开启 lingering,同样开机自启
这种方式适合共享机器;正常 VPS 建议用 root 安装——反正 HTTPS 也需要 80/443。
方式二:手动安装包
从最新 Release 的 Assets 列表下载对应发行版的 code-server 包,然后:
bash
curl -LO https://github.com/yinyue123/16code/releases/latest/download/code-server_v0.1.0_linux_amd64.deb
sudo dpkg -i code-server_*_linux_amd64.deb
sudo systemctl enable --now code-serverbash
curl -LO https://github.com/yinyue123/16code/releases/latest/download/code-server-0.1.0.x86_64.rpm
sudo rpm -i code-server-*.x86_64.rpm
sudo systemctl enable --now code-server文件名随版本变化,以 Release 的 Assets 列表为准。包里带了程序、Web 界面、systemd 服务和默认的 /etc/code.yaml;安装时会自动创建 code 系统用户。
方式三:Docker / Podman
bash
podman pull ghcr.io/yinyue123/16code:latest完整容器部署(卷、端口、配置)见 Docker 部署。
检查运行状态
bash
sudo systemctl status code-server # 应显示 active (running)
curl -sI http://localhost/ # 应返回 HTTP 200下一步
- HTTPS 与域名——把域名指向服务器并开启自动 HTTPS。在公网使用前务必先做这一步。
- 随时可以用
code-server-setup(终端里的方向键配置界面)微调设置。 - 在你的电脑上安装 Agent。