Jacki
Jacki

Reputation: 301

How can I install vs-code-server manually and tell vs-code-remote?

When I try use remote-ssh connect to my server to install install vs-code-server, it hangs with these message: Install and start server if needed

bash: no job control in this shell Installing... Downloading with wget

It seems my server cannot use wget to download vs-code-server. Can I install vs-code-server manually?

Upvotes: 30

Views: 63207

Answers (5)

Yu Wei Liu
Yu Wei Liu

Reputation: 786

Yes, you can manually install the VSCode server, upload it to the endpoint, and access the remote machine.

The solution works for both Linux and Windows, on both Local and Remote systems.

Steps,

  1. Look up the commit-id to determine which version of the VSCode server you need to download.

    Go to the VSCode Appbar, and navigate to "Help" => "About."

    VSCode-version.png

    In my case, the commit-id is 3b889b090b5ad5793f524b5d1d39fda662b96a2a.

  2. Download the VSCode server based on your remote machine's system with the following URL:

    # For Linux
    https://update.code.visualstudio.com/commit:<commit-id>/server-linux-x64/stable
    
    # For Windows
    https://update.code.visualstudio.com/commit:<commit-id>/server-win32-x64/stable
    

    In my case:

    https://update.code.visualstudio.com/commit:3b889b090b5ad5793f524b5d1d39fda662b96a2a/server-linux-x64/stable
    

    You might receive a file named vscode-server-linux-x64.tar.gz for Linux or a file named vscode-server-win32-x64.zip for Windows.

  3. Upload the file to the remote machine.

    On the local machine terminal under the folder where the file located:

    $ scp -r <file-you-just-download> <user-account>@<remote-machine-domain>:<remote-machine-home-folder>/.vscode-server/bin
    

    In my case, it would look like:

    $ scp -r vscode-server-linux-x64.tar.gz [email protected]:/home/liuyuweitarek/.vscode-server/bin
    
  4. Unzip the file.

    On the remote machine terminal:

    $ cd ~/.vscode-server/bin
    
    # For Linux
    $ tar -xzvf vscode-server-linux-x64.tar.gz
    
    # For Windows
    $ upzip vscode-server-win32-x64.zip
    
  5. Organize the structure and renamed folder as below:

    On the remote machine, under the folder ~/.vscode-server/bin:

    $ mv vscode-server-linux-x64 3b889b090b5ad5793f524b5d1d39fda662b96a2a
    

    Folder structure would look like below,

    from:

    |- .vscode-server
     |- bin
      |- vscode-server-linux-x64
       |- (files)
       |- server.sh
    

    to:

    |- .vscode-server
     |- bin
      |- <commit-id> => In my case, would be 3b889b090b5ad5793f524b5d1d39fda662b96a2a
       |- (files)
       |- server.sh
    
  6. Restart VSCode and the Remote-SSH again. This should resolve the issue.

Upvotes: 1

Leonardo
Leonardo

Reputation: 1891

I bundled together a few answers from this question, plus here and here, to whip together this local host (Linux) script that installs in the remote host the correct tar, using the local VSCode version:

#!/bin/bash

GIT_HASH=$(code --version | sed -n '2 p')

# Uncomment for Insider version
#VSCODE_FLAVOUR="insider"
VSCODE_FLAVOUR="${VSCODE_FLAVOUR:-stable}"

ssh user@host <<ENDSSH
cd \$HOME/.vscode-remote-containers/bin
mkdir -p $GIT_HASH && cd $GIT_HASH
wget --content-disposition https://update.code.visualstudio.com/commit:$GIT_HASH/server-linux-x64/$VSCODE_FLAVOUR
tar -xvzf vscode-server-linux-x64.tar.gz --strip-components 1
rm -f vscode-server-linux-x64.tar.gz
ENDSSH

I tried setting localServerDownload to off in the hope that it forces the host/remote to download the tarball to no avail. I still see VSCode using Run: tar --no-same-owner -x --strip-components 1 -C ... to copy the tarball over.

Upvotes: 0

Akintomiwa Opemipo
Akintomiwa Opemipo

Reputation: 419

I used this bash script on my linux container and it works fine. You can try this too.

read -p 'What commit of vscode server do you wish to install? ' commit

echo ""

if [ ! -d "$HOME/.vscode-server/bin/$commit" ] ; then
    mkdir -p install-vscode-server
    cd install-vscode-server
    wget -q https://update.code.visualstudio.com/commit:$commit/server-linux-x64/stable
    tar -xf stable
    mkdir -p ~/.vscode-server/bin
    mv vscode-server-linux-x64 ~/.vscode-server/bin/$commit
    cd ..
    rm -rf install-vscode-server
    echo "vscode server commit:$commit installed"
else
    echo "Commit already installed"
fi

echo ""

Upvotes: 13

FelixWee
FelixWee

Reputation: 411

Download your current used version via

wget https://update.code.visualstudio.com/commit:c3f126316369cd610563c75b1b1725e0679adfb3/server-linux-x64/stable

You can check the commit id in vscode Help -> About

Copy it to your machine through ssh.

Unpack to ~/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3

And you're done

Upvotes: 41

milkice
milkice

Reputation: 515

This problem is caused by your terminal shell path isn't configured rightly.

Follow this issue https://github.com/microsoft/vscode-remote-release/issues/220#issuecomment-490374437

Check which shell you are using: which $SHELL

Upvotes: 2

Related Questions