Last active
April 15, 2021 14:30
-
-
Save its-dibo/de4d5123ac11297e2911b546c7346ce6 to your computer and use it in GitHub Desktop.
install visual studio (code-server) in google cloud shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install code-server using the script | |
curl -fsSL https://code-server.dev/install.sh | sh | |
# add code-server to $PATH. | |
# to set $PATH permenantly (i.e after restarts), add this line to $HOME/.customize_environment or .bashrc file | |
# https://cloud.google.com/shell/docs/configuring-cloud-shell#environment_customization_script | |
# change `code-server-3.9.0-linux-amd64` if needed. | |
> nano $HOME/.customize_environment | |
export PATH="$PATH:$HOME/code-server-3.9.0-linux-amd64/bin" | |
# change the password | |
nano ~/.config/code-server/config.yaml | |
# run the server, then open the web preview | |
code-server | |
# for logs: code-server --verbose | |
# or, enable the background service | |
sudo systemctl enable --now code-server@$USER | |
# to clone a repo: | |
git clone <github_repo> | |
# to automatically install code-server at startup, add it to $HOME/.customize_environment file | |
# ------------------------------------------------- | |
# method #2: installing manually, instead of using the script: | |
# Install code-server | |
# https://github.com/cdr/code-server/ | |
export VERSION=`curl -s https://api.github.com/repos/cdr/code-server/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'` | |
wget https://github.com/cdr/code-server/releases/download/$VERSION/code-server-3.9.0-linux-amd64.tar.gz | |
tar -xvzf code-server-3.9.0-linux-amd64.tar.gz | |
cd code-server-3.9.0-linux-amd64 | |
# Start the server | |
./bin/code-server --auth none --port 8080 | |
# Click on Web Preview -> Preview on port 8080 | |
# If you get a 404, remove ?authuser=0 from the preview url. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment