Last active
June 17, 2020 22:45
-
-
Save alexeldeib/441626a4489e0a244f7d225a02dd59a9 to your computer and use it in GitHub Desktop.
Ubuntu setup script
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
#!/bin/bash | |
set -e | |
GOLANG_VERSION=1.13.8 | |
# Basics | |
sudo apt update -y && sudo apt install -y apt-transport-https curl xclip git build-essential lsb-release gnupg < /dev/null | |
git config --global user.name "Ace Eldeib" | |
# Enable automatic upgrades | |
sudo tee /etc/apt/apt.conf.d/20auto-upgrades > /dev/null <<EOF | |
APT::Periodic::Update-Package-Lists "1"; | |
APT::Periodic::Download-Upgradeable-Packages "1"; | |
APT::Periodic::AutocleanInterval "7"; | |
APT::Periodic::Unattended-Upgrade "1"; | |
EOF | |
# Enable passwordless sudo | |
sudo tee /etc/sudoers.d/ace > /dev/null <<EOF | |
ace ALL=(ALL) NOPASSWD:ALL | |
EOF | |
sudo swapoff -a | |
### Dev tools | |
# Install Golang | |
curl -O https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz | |
sudo tar -xvf go${GOLANG_VERSION}.linux-amd64.tar.gz -C /usr/local | |
# Add Go to path | |
sudo mkdir -p /home/ace | |
sudo touch /home/ace/.bashrc | |
sudo tee -a /home/ace/.bashrc > /dev/null <<'EOF' | |
export PATH=$PATH:/usr/local/go/bin | |
export PATH=$PATH:/home/ace/go/bin | |
export GOPATH=/home/ace/go | |
EOF | |
export GOPATH=/home/ace/go | |
export PATH=$PATH:/usr/local/go/bin | |
export PATH=$PATH:/home/ace/go/bin | |
# Dep | |
go get -d -u github.com/golang/dep | |
pushd "$(go env GOPATH)/src/github.com/golang/dep" | |
DEP_LATEST=$(git describe --abbrev=0 --tags) | |
git checkout $DEP_LATEST | |
go install -ldflags="-X main.version=$DEP_LATEST" ./cmd/dep | |
git checkout master | |
popd | |
# VS Code | |
sudo snap install code --classic | |
# MS Signing key | |
curl -sL https://packages.microsoft.com/keys/microsoft.asc | \ | |
gpg --dearmor | \ | |
sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null | |
AZ_REPO=$(lsb_release -cs) | |
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \ | |
sudo tee /etc/apt/sources.list.d/azure-cli.list | |
sudo apt-get update | |
sudo apt-get install -y azure-cli < /dev/null | |
# Docker | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get update | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io < /dev/null | |
# Create environment variable for correct distribution | |
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" | |
# Add the Cloud SDK distribution URI as a package source | |
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
# Import the Google Cloud Platform public key | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
# Update the package list and install the Cloud SDK | |
sudo apt-get update -y && sudo apt-get install -y google-cloud-sdk < /dev/null | |
# JDK | |
sudo apt-get install -y openjdk-8-jdk < /dev/null | |
# Bazel | |
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list | |
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - | |
sudo apt-get update && sudo apt-get install -y bazel | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment