Skip to content

Instantly share code, notes, and snippets.

@XavierGeerinck
Last active August 24, 2023 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XavierGeerinck/a9ba5f50f1bb955291e3417d32751abc to your computer and use it in GitHub Desktop.
Save XavierGeerinck/a9ba5f50f1bb955291e3417d32751abc to your computer and use it in GitHub Desktop.
Setup a new Ubuntu environment with the required tools for easy development
# Update
sudo apt update -y
# Install ZSH
sudo apt-get install zsh
# Install Oh-My-Zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Install Oh-My-Zsh Spaceship Theme
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
ZSH_THEME="spaceship"
# Config Oh-My-Zsh Theme and enable waiting dots
COMPLETION_WAITING_DOTS="true"
sed -i 's/# COMPLETION_WAITING_DOTS="true"/COMPLETION_WAITING_DOTS="true"/g' ~/.zshrc
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="spaceship"/g' ~/.zshrc
# Add Plugin - Syntax Highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Add Plugin - AutoSuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# Enable plugins
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc
# Set ZSH as the default shell
chsh -s $(which zsh)
# Restart terminal
exec zsh
# Install .NET
# https://docs.microsoft.com/en-gb/dotnet/core/install/linux-scripted-manual#scripted-install
wget -q https://dot.net/v1/dotnet-install.sh -O - | /bin/bash -s -- --channel Current
echo 'export PATH="$HOME/.dotnet:$PATH"' >> ~/.bashrc
echo 'export PATH="$HOME/.dotnet/tools:$PATH"' >> ~/.bashrc
echo 'export DOTNET_ROOT="$HOME/.dotnet"' >> ~/.bashrc
echo 'export PATH="$HOME/.dotnet:$PATH"' >> ~/.zshrc
echo 'export PATH="$HOME/.dotnet/tools:$PATH"' >> ~/.zshrc
echo 'export DOTNET_ROOT="$HOME/.dotnet"' >> ~/.zshrc
# Install NVM
# https://github.com/nvm-sh/nvm/releases
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
exec "$SHELL"
# Install Node
# view latest with: nvm ls-remote --lts
# current lts = v14.16.1
nvm install --lts
# Install PyEnv
sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
exec "$SHELL"
# Install python 3.8.6
pyenv install 3.8.16
pyenv global 3.8.16
# Install AZ CLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Install PostgreSQL
sudo apt install postgresql postgresql-contrib
# Setup User Postgres
sudo service postgresql start
sudo -u postgres psql
ALTER USER postgres PASSWORD 'postgres';
exit
# Install Docker
curl -sSL https://get.docker.com/ | sh
# Docker Rootless Setup (install newuidmap and newgidmap)
sudo usermod -aG docker $USER
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
dockerd-rootless-setuptool.sh install --skip-iptables
echo 'export DOCKER_HOST=unix:///var/run/docker.sock' >> ~/.bashrc
echo 'export DOCKER_HOST=unix:///var/run/docker.sock' >> ~/.zshrc
# Install Dapr
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
dapr --version
dapr init
# Remove Password Requirement for Sudo
# Note: only on non-prod machines!!
echo "`whoami` ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/`whoami` && sudo chmod 0440 /etc/sudoers.d/`whoami`
# Generate an SSH Key
ssh-keygen -t ed25519 -C "your_email@example.com"
# Install pulumi
curl -fsSL https://get.pulumi.com | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment