Skip to content

Instantly share code, notes, and snippets.

@austin-millan
Created April 4, 2019 23:39
Show Gist options
  • Save austin-millan/d46cc48b6f1fff5766af75c3b9fc3302 to your computer and use it in GitHub Desktop.
Save austin-millan/d46cc48b6f1fff5766af75c3b9fc3302 to your computer and use it in GitHub Desktop.
Configures a dev environment on a Debian system
#! /bin/bash
# Debian Dev Environment Configuration
sudo apt-get -y update
sudo apt-get -y upgrade
res=$(sudo apt-get install -y git vim build-essential default-jre default-jdk apt-transport-https)
if [[ "$res" -ne 0 ]] ; then
echo "Unable to install git, vim, build-essential, default-jre, default-jdk, apt-transport-https)"
fi
# Docker
res=$(sudo apt-get install -y ca-certificates curl software-properties-common)
if [[ "$res" -ne 0 ]] ; then
echo "Unable to install ca-certificates, curl, or software-properties-common)"
fi
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get -y update
res=$(apt-get -y install docker-ce)
if [[ "$res" -ne 0 ]] ; then
echo "Unable to install docker-ce."
else
systemctl status docker
docker -v
usermod -a -G docker $USER
fi
# VS Code
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
apt-get update
res=$(apt-get install code) # or code-insiders
res=$(apt-get -y install docker-ce)
if [[ "$res" -ne 0 ]] ; then
echo "Unable to install VS Code."
fi
# Cargo / Rust
res=$(curl -sf -L https://static.rust-lang.org/rustup.sh > rustup.sh)
if [[ "$res" -ne 200 ]] ; then
echo "Possible HTTP error response while downloading installer for Rust."
else
chmod +x rustup.sh
./rustup -y
rustc --version
fi
rm rustup.sh
res=$(sudo apt-get install cargo)
if [[ "$res" -ne 0 ]] ; then
echo "Unable to install Cargo for Rust."
else:
cargo --version
fi
# Golang
res=$(wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz)
err=""
if [[ "$res" -ne 0 ]] ; then
if [[ "$res" -eq 1 ]] ; then
err="Generic error code."
elif [[ "$res" -eq 2 ]] ; then
err="Parse error---for instance, when parsing command-line options"
elif [[ "$res" -eq 3 ]] ; then
err="File I/O error."
elif [[ "$res" -eq 4 ]] ; then
err="Network failure."
elif [[ "$res" -eq 5 ]] ; then
err="Network failure."
elif [[ "$res" -eq 6 ]] ; then
err="Username/password authentication failure."
elif [[ "$res" -eq 7 ]] ; then
err="Protocol errors."
elif [[ "$res" -eq 8 ]] ; then
err="Server issued an error response."
fi
else
mkdir $HOME/go
sudo tar -xvf go1.11.4.linux-amd64.tar.gz
sudo mv go/ /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
go version
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment