Skip to content

Instantly share code, notes, and snippets.

@bvsatyaram
Last active July 9, 2020 00:06
Show Gist options
  • Save bvsatyaram/36fc10f2387ef78692a497e060c25485 to your computer and use it in GitHub Desktop.
Save bvsatyaram/36fc10f2387ef78692a497e060c25485 to your computer and use it in GitHub Desktop.
Ubuntu 18.04 Setup

Basics

Update and upgrade

sudo apt update
sudo apt -y upgrade
sudo apt install -y vim

Setup Git

Install git

sudo apt install -y git

Create SSH key:

ssh-keygen
# Hit enter for all the prompts
cat ~/.ssh/id_rsa.pub

Upload the ssh key to github

Setup your git credentials

git config --global user.name "<Your Name>"
git config --global user.email <Your Email>

Enable git to push current branch

git config --global push.default current

Setup vim as the git editor

git config --global core.editor "vim"

Setup meld as the diff viewer

Install meld

sudo apt install -y meld

Add the following to your ~/.gitconfig file.

[diff]
    tool = meld
[difftool]
    prompt = false
[difftool "meld"]
    cmd = meld "$LOCAL" "$REMOTE"

Setup oh-my-zsh

Install zsh and powerline fonts

sudo apt install -y zsh powerline fonts-powerline
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
vim .zshrc
# Find the line ZSH_THEME="robbyrussell" replace robbyrussell with "agnoster" theme in .zshrc
# ZSH_THEME="agnoster"

# Change the default shell
chsh -s /bin/zsh

# Enable syntax highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.zsh-syntax-highlighting" --depth 1
echo "source $HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> "$HOME/.zshrc"

Reboot the machine to see the new shell in action.

Setup Docker

Install Docker: Ref: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
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 bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install -y docker-ce
# Check if docker is running
sudo systemctl status docker

# Executing the Docker Command Without Sudo 
sudo usermod -aG docker ${USER}
su - ${USER}
# Confirm that the user is added to docker group
id -nG

Install docker-compose. Ref: https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-18-04

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Confirm that docker-compose is installed
docker-compose --version

Reboot the machine before starting to use docker-compose

Setup custom aliases

Note: These are my personal preferences.

vim ~/.bv_bashrc

Add the following lines to the file:

# Git Aliases
alias gs='git status'
alias gd='git difftool'
alias gdc='gd --cached'

# Docker Aliases
alias dc='docker-compose'
alias dcb='dc build'
alias dcu='dc up'
alias dce='dc exec'
alias dcr='dc run'

# Miscellaneous
# alias chapp='sudo chmod -R 777 app/**/* db/**/* spec/**/*'
alias chapp='sudo chown -R $USER:$USER .'

Add the following towards the end of ~/.zshrc:

source ~/.bv_bashrc

Setup a signoff for commmits

Let us assume that your email id is '[email protected]' and you would like to have all the commits signed-off by '[email protected]'.

Set up the sign-off person as the default author, at the project level:

# cd to the project directory
git config user.name "<Sign-off Person Name>"
git config user.email <Sign-off Person Email>

Setup an alias for easy sign-off. Add the following to your aliases file.

alias gcbv='git commit --signoff  --author="Your Name <your@email>"'
alias gca='git commit --amend  --signoff  --author="Your Name <your@email>"'

Install ansible

sudo apt install -y software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible

Keep ssh connection alive longer

Add the following to ~/.ssh/config:

Host *
  ServerAliveInterval 30
  ServerAliveCountMax 5

Setup Airbnb styleguides with ESlint and prettier

Ref: Integrating Prettier + ESLint + Airbnb Style Guide in VSCode

Fix: Visual Studio Code is unable to watch for file changes in this large workspace

Add the following line to the end of the file /etc/sysctl.conf:

fs.inotify.max_user_watches=524288

Then run:

sudo sysctl -p

Install nvidia driver

Note: This is tested for GTX1650. Youmight need a different version of driver for your graphics card.

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

Now, lnch Software & Updates utility, and navigate to Additional Drivers tab. hen choose using “NVIDIA driver metapackage from nvidia-driver-430” from the list and click Apply Changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment