一些离线安装的技巧

一些离线安装的技巧

离线安装 vscode

背景:在 vscode 中使用 remote-ssh 插件时,需要在远程服务器安装 vscode-server。在无法正常访问网络时,可按以下步骤进行离线安装。

https://stackoverflow.com/questions/56671520/how-can-i-install-vscode-server-in-linux-offline

  1. First get commit id

  2. Download vscode server from url:

    1
    
    https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable
    
  3. Upload the vscode-server-linux-x64.tar.gz to server

  4. Unzip the downloaded vscode-server-linux-x64.tar.gz to ~/.vscode-server/bin/${commit_id} without vscode-server-linux-x64 dir

  5. Create 0 file under ~/.vscode-server/bin/${commit_id}

其中 commit_id 与使用的 vscode 版本对应,可通过查看 tags 进行确定。

1
2
3
4
5
6
7
8
9
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

在 vscode server 上离线安装 vscode 插件

https://www.cnblogs.com/understandWorld/articles/12856323.html

进入 VScode 插件市场网址 https://marketplace.visualstudio.com/vscode,下载插件

在 Linux 上离线安装:

1
code --extensions-dir ~/.vscode-server/extensions/ --install-extension  xxx/xxx.vsix