Install Ubuntu

January 2, 2021

2 min read

Install Ubuntu

Install Chrome

  • wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  • sudo dpkg -i google-chrome-stable_current_amd64.deb
  • sudo apt install -y chrome-gnome-shell

Install Visual studio code

  • code.visualstudio.com
  • Right click menu for vscode:
    • wget -qO- https://raw.githubusercontent.com/cra0zy/code-nautilus/master/install.sh | bash

Font Manager

Gnome Tweak Tool

  • sudo apt install -y gnome-tweak-tool

Extensions for Gnome

NTFS Fix

Add Startup Program

  • NTFS Fix SDA1 && sudo ntfsfix /dev/sda1
  • NTFS Fix SDA2 && sudo ntfsfix /dev/sda2

Configure Ubuntu Dock

  • sudo apt install dconf-editor
  • gsettings set org.gnome.shell.extensions.dash-to-dock background-opacity 0.3
  • gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 40
  • gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize-or-previews'

Fix Dual booting

  • timedatectl set-local-rtc 1

Dracula theme for gnome terminal

  • cd ~/Downloads
  • git clone https://github.com/dracula/gnome-terminal
  • cd gnome-terminal
  • ./install.sh
  • cd .. && rm -r gnome-terminal

ZSH

  • sudo apt install git vim curl
  • sudo apt install -y zsh
  • sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • chsh -s /bin/zsh && logout and re-login

Powerlevel10k

  • Download and install Meslo Nerd Font
  • git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
  • vim ~/.zshrc && Set ZSH_THEME="powerlevel10k/powerlevel10k" && source ~/.zshrc
  • Gnome terminal font: MesloLGS NF Regular

Plugin for ZSH

  • git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
  • Set: plugins=(git zsh-syntax-highlighting zsh-autosuggestions zsh-completions)
  • Add: autoload -U compinit && compinit

Dracula theme for zsh

  • cd ~/Downloads && git clone https://github.com/dracula/zsh.git
  • cd zsh
  • mv dracula.zsh-theme ~/.oh-my-zsh/themes
  • mv lib ~/.oh-my-zsh/themes/lib/
  • Go to your ~/.zshrc file and set ZSH_THEME="dracula"
  • source ~/.zshrc

pyenv and pyenv-virtualenv

  • curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  • sudo apt-get update; 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-virtualenvwrapper.git $(pyenv root)/plugins/pyenv-virtualenvwrapper
  • pyenv virtualenvwrapper
  • Add the following to ~/.zshrc:
    • export PATH="/home/hien/.pyenv/bin:$PATH"
    • eval "$(pyenv init -)"
    • eval "$(pyenv virtualenv-init -)"

XDM

Cuda

Cuda 10.2, Ubuntu 20.04

Switch to gcc/g++ verion 8 (only ubuntu 20.04)

  • sudo apt install build-essential
  • sudo apt -y install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9
    • sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
    • sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
    • sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
    • sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
    • sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
    • sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
  • sudo update-alternatives --config g++
  • sudo update-alternatives --config gcc

Cuda toolkit

  • wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
  • sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
  • sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
  • sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
  • sudo apt-get update
  • sudo apt-get -y install cuda
  • export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
  • export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
  • cuda-install-samples-10.2.sh ~
  • cd ~/NVIDIA_CUDA-10.2_Samples/5_Simulations/nbody
  • make && ./nbody -benchmark

Cudnn

  • tar -xzvf cudnn-10.2-linux-x64-v7.6.5.32.tgz
  • sudo cp cuda/include/cudnn.h /usr/local/cuda/include
  • sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
  • sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
  • sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
  • sudo ldconfig -v | grep cudnn # libcudnn.so.7 -> libcudnn.so.7.6.5
  • sudo ln -sf /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7.6.5 /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7
  • sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb
  • sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb
  • cp -r /usr/src/cudnn_samples_v7/ $HOME
  • cd $HOME/cudnn_samples_v7/mnistCUDNN
  • make clean && make && ./mnistCUDNN
  • Make tensorflow support cuda 10.2: sudo ln -s /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudart.so.10.2 /usr/lib/x86_64-linux-gnu/libcudart.so.10.1