5
Service:VS Code
Jeffery edited this page 2026-06-11 10:03:47 +08:00

簡介

code-server 可在伺服器上執行 VS Code,並透過瀏覽器遠端使用。本文記錄在 Ubuntu 上安裝 code-server 的步驟。

安裝相依套件

安裝腳本下載過程需要 curl。

apt update && apt install -y curl

安裝 VS Code

透過官方安裝腳本安裝 code-server。

curl -fsSL https://code-server.dev/install.sh | sh

啟動服務

設為開機自動啟動並啟動目前使用者的 code-server 服務,再檢視狀態。

systemctl daemon-reload && systemctl enable --now code-server@$USER && systemctl start code-server@$USER && systemctl status code-server@$USER

預設密碼

首次啟動後,登入密碼會自動產生並寫入設定檔。

cat ~/.config/code-server/config.yaml