tools,

Setup Workstation

Cui Cui Follow Jan 01, 2021 · 3 mins read
Setup Workstation
Share this

“Place which dreams come true “ - Art by painter Julia Makors

Install brew.sh

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap homebrew/cask-versions

Install zsh && Oh My Zsh

brew install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s $(which zsh)

Install zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
plugins=(zsh-autosuggestions)

# Theme
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

vi ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"

Install Java

Oracle JDK

brew install --cask oracle-jdk

Adopt OpenJDK

brew tap adoptopenjdk/openjdk
brew search jdk
brew install --cask adoptopenjdk
brew install --cask adoptopenjdk11

Switch version with JEnv

brew install jenv

jenv add /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home

Or

## JDK
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
export JAVA_17_HOME=$(/usr/libexec/java_home -v17)
alias java11='export JAVA_HOME=$JAVA_11_HOME'
alias java17='export JAVA_HOME=$JAVA_17_HOME'

SDKMAN

Java SDK Manager

Install Maven, Gradle

brew install maven
brew install gradle

SSH Keys

KEY_TYPE=github
KEY_NAME=`whoami`-$KEY_TYPE-`date +%Y-%m-%d`
mkdir -p ~/.ssh/$KEY_TYPE

ssh-keygen -t rsa -b 2048 -C $KEY_NAME -f ~/.ssh/$KEY_TYPE/$KEY_NAME
ssh-keygen -l -E md5 -f ~/.ssh/$KEY_TYPE/$KEY_NAME

chmod 600 $KEY_NAME
chmod 644 $KEY_NAME.pub

ssh-add --apple-use-keychain --apple-load-keychain ~/.ssh/$KEY_TYPE/$KEY_NAME
# macOS reboot service
vi ~/.ssh/config
Host *
   AddKeysToAgent yes
   UseKeychain yes
   IdentityFile ~/.ssh/$KEY_TYPE/$KEY_NAME

Multi-Git Identities setup

Update .ssh config, to allow personal account for specific host

vi ~/.ssh/config
# default config
Host github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/$KEY_TYPE/$KEY_NAME

# removes all ssh entries from the ssh-agent, and add the only you want to use
ssh-add -D
ssh-add --apple-use-keychain --apple-load-keychain ~/.ssh/$KEY_TYPE/$KEY_NAME

Confirm local git config is right identity info

# list all global git config
git config --global -l

# update global git config
vi ~/.gitconfig
[user]
	name = WorkIdentity
	email = work@gmail.com
[includeIf "gitdir/i:~/Workspace/GitHub/"]
    path = ~/.github.gitconfig

# create specific config for the personal identity
vi ~/.github.gitconfig
[user]
	name = PersonalIdentity
	email = personal@gmail.com

Git Repo

# This will use personal Git Identity
cd ~/Workspace/GitHub/
git clone git@github.com:xxxxxxxx/yyyyyyyyyy.git

# This will use work Git Identity
cd ~/Workspace/AnyOtherFolders
git clone git@github.com:xxxxxxxx/yyyyyyyyyy.git

Install Cloud CLIs

  • Azure CLI
brew install azure-cli

az login

az account set --subscription "ColourfulCodes - Subscriptions"

az aks get-credentials --name kube-cluster-name --resource-group group-name

kubectl config set-context kube-cluster-name --namespace=application
  • GCP CLI
brew install --cask google-cloud-sdk

# zsh
export CLOUDSDK_PYTHON="/usr/local/opt/python@3.8/libexec/bin/python"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"

# gcloud
gcloud init

# k8s
gcloud container clusters get-credentials cluster1 --region europe-west2 --project project-name

8 install Terraform

brew tap hashicorp/tap

brew install hashicorp/tap/terraform

brew upgrade hashicorp/tap/terraform

brew link --overwrite terraform@0.12

Install Kubernetes CLI

brew install kubernetes-cli

OR

brew install kubectl

Install Docker Desktop

Install MongoDB CLI

brew tap mongodb/brew

brew install mongodb-community-shell

brew install mongocli

brew install mongodb-database-tools

# Upgrade
brew upgrade mongodb-database-tools

Install tree, fzf, ack

Join Newsletter
Get the latest news right in your inbox. We never spam!
Cui
Written by Cui Follow
Hi, I am Z, the coder for cuizhanming.com!