Skip to content

Instantly share code, notes, and snippets.

@sunfkny
Last active January 31, 2023 03:23
Show Gist options
  • Save sunfkny/a80a17debcbd1149dc5237ce383ca791 to your computer and use it in GitHub Desktop.
Save sunfkny/a80a17debcbd1149dc5237ce383ca791 to your computer and use it in GitHub Desktop.
install vscode server with a single command
commit_id=$(python -c "print(__import__('requests').get('https://update.code.visualstudio.com/api/update/linux-x64/stable/VERSION').json()['version'])") && mkdir -p ~/.vscode-server/bin/${commit_id} && cd ~/.vscode-server/bin/${commit_id} && wget https://vscode.cdn.azure.cn/stable/${commit_id}/vscode-server-linux-x64.tar.gz -O vscode-server-linux-x64.tar.gz && tar zxvf vscode-server-linux-x64.tar.gz --strip 1
@sunfkny
Copy link
Author

sunfkny commented Jan 31, 2023

Online installation readable version

/bin/bash -c "$(curl -fsSL https://vscode-server.deno.dev)"

or

if [ -f /etc/redhat-release ]; then
    yum install -y jq
elif [ -f /etc/lsb-release ]; then
    apt install -y jq
fi

file_name="vscode-server-linux-x64.tar.gz"
commit_id=$(curl -s https://update.code.visualstudio.com/api/update/linux-x64/stable/VERSION | jq -r .version)
local_path="~/.vscode-server/bin/${commit_id}"

mkdir -p $local_path
echo $local_path

wget https://vscode.cdn.azure.cn/stable/${commit_id}/vscode-server-linux-x64.tar.gz -O $local_path/$file_name
tar zxvf $local_path/$file_name --strip 1 -C $local_path

Offline installation

$remote_host = "127.0.0.1"
$remote_user = "root"
$remote_port = 22

$file_name = "vscode-server-linux-x64.tar.gz"
$commit_id = Invoke-WebRequest -Uri https://update.code.visualstudio.com/api/update/linux-x64/stable/VERSION -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty version
$remote_path = "~/.vscode-server/bin/${commit_id}"

wget https://vscode.cdn.azure.cn/stable/${commit_id}/vscode-server-linux-x64.tar.gz -O ${file_name}

scp vscode-server-linux-x64.tar.gz to remote server
ssh ${remote_user}@${remote_host} -p ${remote_port} mkdir -p ${remote_path}
scp -P ${remote_port} ${file_name} ${remote_user}@${remote_host}:${remote_path}/${file_name}
ssh ${remote_user}@${remote_host} -p ${remote_port} tar zxvf ${remote_path}/${file_name} --strip 1 -C ${remote_path}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment