Created
May 30, 2019 11:04
-
-
Save manparvesh/f7890a6031e076f7b4587bcfdcd4eeb2 to your computer and use it in GitHub Desktop.
VS Code setup on AWS EC2
This file contains hidden or 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
#!/usr/bin/env bash | |
# This script is to run VSCode in a remote server using code-server | |
# https://github.com/cdr/code-server | |
# get tar.gz file that contains the binary | |
mkdir ~/code-setup | |
cd ~/code-setup | |
CODE_SERVER_VERSION="1.1119-vsc1.33.1" | |
CODE_SERVER_ARCH="linux-x64" | |
CODE_SERVER_FOLDER_NAME="code-server$CODE_SERVER_VERSION-$CODE_SERVER_ARCH" | |
CODE_SERVER_FILE_NAME="$CODE_SERVER_FOLDER_NAME.tar.gz" | |
wget "https://github.com/cdr/code-server/releases/download/$CODE_SERVER_VERSION/$CODE_SERVER_FILE_NAME" | |
# you can change the file if you want the latest version after checking here: https://github.com/cdr/code-server/releases | |
# extract contents | |
tar -xvzf "$CODE_SERVER_FILE_NAME" | |
cd "$CODE_SERVER_FOLDER_NAME" | |
chmod +x code-server | |
# make setup secure | |
mkdir ~/certs && cd ~/certs | |
openssl genrsa -out server.key 1024 | |
touch openssl.cnf | |
cat >> openssl.cnf <<EOF | |
[ req ] | |
prompt = no | |
distinguished_name = req_distinguished_name | |
[ req_distinguished_name ] | |
C = GB | |
ST = Test State | |
L = Test Locality | |
O = Org Name | |
OU = Org Unit Name | |
CN = Common Name | |
emailAddress = [email protected] | |
EOF | |
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ~/certs/MyKey.key -out ~/certs/MyCertificate.crt -config openssl.cnf | |
# now run using this command: | |
# sudo ./code-server -p 80 --cert=~/certs/MyCertificate.crt --cert-key=~/certs/MyKey.key "~" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment