Skip to main content

Linux setup

Install basic Linux packages

sudo apt-get update 
sudo apt-get install -y vim net-tools git ssh htop openssh-server python3-pip ca-certificates
sudo ufw allow ssh

Install ZSH

Basic:

sudo apt-get update && sudo apt-get install -y zsh autojump fonts-powerline
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

Plugins:

## Resolved:  Could not resolve host: github.com
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k

sed -i -e 's/# DISABLE_UNTRACKED_FILES_DIRTY="true"/DISABLE_UNTRACKED_FILES_DIRTY="true"/1' ~/.zshrc
sed -i 's/plugins=(git)/plugins=(git autojump zsh-autosuggestions)/1' ~/.zshrc
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="powerlevel10k\/powerlevel10k" # ZSH_THEME="robbyrussell"/g' ~/.zshrc
sed -i '$a\POWERLEVEL9K_MODE="awesome-patched"' ~/.zshrc

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
echo "source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

You can use this p10k configure to set the style.

The order is as follows: n n n n 1 2 3 1 2 1 n 1 y

Set as default:

sudo chsh -s $(which zsh)

Personal zshrc file

.zshrc
# CUDA
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.4/lib64
export CUDA_INSTALL_DIR=/usr/local/cuda-11.4
export PATH=$PATH:/usr/local/cuda-11.4/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-11.4
export PATH=/usr/local/cuda-11.4/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

# TensorRT
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/chieh/TensorRT-8.2.0.6/lib
export TRT_RELEASE=/home/chieh/TensorRT-8.2.0.6

# Bashtop
export PATH="$PATH:/home/chieh/bashtop"

# Json tool
export PATH="$PATH:/home/json_tool"

# HUGO tool
export PATH="$PATH:/home/chieh/hugo"

# kubeflow
# export PATH="$PATH:/home/chieh/minikube"

export KF_NAME=kf-test
# export BASE_DIR=/home/chieh/kubeflow_use ## before at /home/chieh/minukube
export BASE_DIR=/home/chieh/minukube

export KF_DIR=${BASE_DIR}/${KF_NAME}
export CONFIG_URI="https://raw.githubusercontent.com/kubeflow/manifests/v1.1-branch/kfdef/kfctl_k8s_istio.v1.1.0.yaml"

# K8s
# Ref: https://kubernetes.io/docs/tasks/tools/install-kubectl/
source <(kubectl completion zsh)
autoload -Uz compinit
compinit

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/chieh/gcp/google-cloud-sdk/path.zsh.inc' ]; then . '/home/chieh/gcp/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/home/chieh/gcp/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/chieh/gcp/google-cloud-sdk/completion.zsh.inc'; fi


[[ -s /home/chieh/.autojump/etc/profile.d/autojump.sh ]] && source /home/chieh/.autojump/etc/profile.d/autojump.sh
autoload -U compinit && compinit -u
export PATH="$PATH:/usr/local/lib/pkgconfig"
alias e='exit'
alias cdd='j'

alias di='docker images'
alias dp='docker ps'
alias n='nvidia-smi'

alias gs='git status'
alias ga='git add'
alias gc='git commit -m "update" && git push'
alias gp='git pull'

alias asciicast2gif='docker run --rm -v $PWD:/data asciinema/asciicast2gif'
alias dn='docker network'
alias docker-compose='/usr/local/bin/docker-compose'

[[ -s "/home/chieh/.gvm/scripts/gvm" ]] && source "/home/chieh/.gvm/scripts/gvm"

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"


# Install Ruby Gems to ~/gems

export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"

Docker

sudo apt install -y apt-transport-https curl gnupg-agent 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 $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo chmod 777 /var/run/docker.sock

Docker-compose

Please refer to Docker compose installation.

The version is v2.23.1

sudo curl -L "https://github.com/docker/compose/releases/download/v2.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose