如何在 linux 中离线安装 vscode-server

Ds.*_*ale 23 visual-studio-code

我正在尝试安装 VScode 远程 ssh 扩展,但我的远程主机无法连接到 Internet,因此无法下载软件。所以我收到了一些这样的错误信息:

SSH Resolver called for "ssh-remote+kf"
SSH Resolver called for host: kf
Setting up SSH remote "kf"
Using commit id "daf71423252a707b8e396e8afa8102b717f8213b" and quality "insider" for server
Install and start server if needed
> bash: no job control in this shell
> Installing...
> Downloading with wget
> ERROR: certificate common name “*.azurewebsites.net” doesn’t match requested host name “update.code.visualstudio.com”. To connect to update.code.visualstudio.com insecurely, use ‘--no-check-certificate’.
> 2b948abc-b874-4ef5-875a-a29370a5f844##25##
"install" terminal command done
Received install output: 2b948abc-b874-4ef5-875a-a29370a5f844##25##
Server download failed
Downloading VS Code Server failed. Please try again later.
Run Code Online (Sandbox Code Playgroud)

我怎么能解决这个问题?

yax*_*xin 52

  1. 首先获取提交ID
  2. 从 url 下载 vscode 服务器: https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable
  3. 上传vscode-server-linux-x64.tar.gz到服务器
  4. 将下载的解压vscode-server-linux-x64.tar.gz~/.vscode-server/bin/${commit_id}不带 vscode-server-linux-x64 目录
  5. 0在下创建文件~/.vscode-server/bin/${commit_id}
commit_id=f06011ac164ae4dc8e753a3fe7f9549844d15e35

# Download url is: https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable
curl -sSL "https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable" -o vscode-server-linux-x64.tar.gz

mkdir -p ~/.vscode-server/bin/${commit_id}
# assume that you upload vscode-server-linux-x64.tar.gz to /tmp dir
tar zxvf /tmp/vscode-server-linux-x64.tar.gz -C ~/.vscode-server/bin/${commit_id} --strip 1
touch ~/.vscode-server/bin/${commit_id}/0
Run Code Online (Sandbox Code Playgroud)

- 或者 -

请参阅此 Gist download-vs-code-server以获取更完整的 shell 脚本,该脚本还将获取最新发布的提交 SHA(来自 GitHub),因此您无需自己提供。


[编辑添加有用的评论,以防评论稍后消失:]

您可以替换commit:<commit>latest以获取最新的发布版本。例子:https://update.code.visualstudio.com/latest/server-linux-x64/stable。尊重指示的质量,即stableinsider。–毁灭战士 5

  • 您可以将 `commit:&lt;commit&gt;` 替换为 `latest` 以获得最新版本。示例:“https://update.code.visualstudio.com/latest/server-linux-x64/stable”。尊重表明质量,即“稳定”、“内部”。 (3认同)
  • 仅供参考,commit_id 与此处发布的提交哈希值匹配:https://github.com/microsoft/vscode/releases (3认同)
  • @idailylife 一旦有新版本,您将无法连接到远程,因为 vscode 将使用新的提交 id 来连接不存在的服务器 (2认同)
  • 我有多少次回到这个救命的答案...... (2认同)