Setup after newly installed Linux Mint:
For the installation of Zsh and Oh My Zsh, we need a number of tools which can be installed using the below command:
sudo apt-get update
sudo apt install wget curl git -yZsh is already available in Linux Mint 20 repository making it easy to install. Run the command below:
sudo apt-get install zsh -yCheck the installed version to confirm Zsh installation:
zsh –versionOnce installed, change the default shell of root user to zsh by running the below command:
sudo chsh -s /usr/bin/zsh $USERNow log out from the current shell then log back in. When you switch to root user, you will notice that the shell has changed. To verify which shell you are currently in, run the below command, shoud output usr/bin/zsh:
echo $SHELLAs explained before, Oh-My-Zsh is used to manage Z shell and it provides quite a number of functions,themes and plugins. To install Oh-My-Zsh, we first need to install some packages that will enable us to download Oh-My-Zsh installer script:
sudo apt-get install wget gitNow down and execute Oh-My-Zsh installer script:
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zshThe output should be as below:
Just as Bash has .bashrc configuration file, Zsh also needs to have a configuration file called .zshrc which is found in the Oh-My-Zsh template directory if not already on your home directory. To enable the configuration file, run the below commands, first one if .zshrc is not on your home directory or jump to the second command if you have .zshrc in your home directory:
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc:
source ~/.zshrcCheck available themes. The current default theme provided by Oh-My-Zsh is ‘robbyrusell‘ theme.:
cd ~/.oh-my-zsh/themes/
ls -aTo change theme in ~/.zshrc. Thats the theme I use:
ZSH_THEME="agnoster"
Powerlevel10k is also nice alternative theme.
To check available plugins:
cd ~/.oh-my-zsh/plugins/
ls -aTo add plugins in ~/.zshrc. These the plugins I use:
plugins=(virtualenv git gitfast git-open direnv dnf iterm2 kubectl terraform alias-tips aws brew vscode colorize dirhistory extract zsh-completions zsh-autosuggestions history-substring-search zsh-syntax-highlighting colored-man-pages forgit)
Git clone needed plugins(forgit requires fzf):
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions
git clone https://github.com/paulirish/git-open
git clone https://github.com/zsh-users/zsh-completions
git clone https://github.com/djui/alias-tips
git clone https://github.com/ael-code/zsh-colored-man-pages
git clone https://github.com/wfxr/forgitIt's recommended installing node and npm using nvm.
Then:
nvm install nodeThe -o flag forces the tool to generate SSH keys with the OpenSSH format. The -t flag specifies they type of SSH keys to create. The -C flag allows for comments that get added as metadata at the end of the public key.
cd ~/.ssh
ssh-keygen -o -t rsa -C "email@example.com"
cat id_rsa.pub
eval "$(ssh-agent -s)"
ssh-add id_rsaLog into GitHub, Navigate settings > SSH and GPG keys > New GitHub SSH key. Provide a unique name, and paste the value of the private GitHub SSH key you copied earlier. Once you copy the SSH URL of the GitHub repo, you can use it to clone a copy of the remote repo into the local environment. On the initial clone, you might get a message that questions the authenticity of the host. This due to the lack of a third party certificate authority to validate your keys. If you are confident in the validity of the keys you just created — which you certainly should be, because you created them — just type yes to carry on with an SSH clone of the GitHub repo.
To install it we'll run the bash installer they provide. We could use the package manager of our distribution, but the bash installer will ensure we install the latest version available:
curl -sfL https://direnv.net/install.sh | bashFirst have to install zsh. Now we need to hook direnv to bash. We'll edit ~/.zshrc and then reload it:
echo 'eval "$(direnv hook bash)"' >> ~/.zshrc
source ~/.zshrcThis way direnv will link itself to the shell and will be executed always before each prompt. We will never notice it's working on the background. direnv will check if something needs to be loaded on the current folder. It checks the existence of a file named .envrc, with instructions on what should be loaded.
To load Python Virtual Environments in your working directory we run the layout command, followed by the Python version:
echo 'layout python' > .envrcpyenv is a version management utility for Python. It allows, among other things, to change Python versions on a per-project basis. direnv provides support for it since version 2.21.0, so together they can give us a higher level of control on the version we use in our environment.
Install pyenv:
curl -L https://pyenv.run | bashAnd then ensuring it will always be accessible to our terminal:
echo 'export PATH="~/.pyenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bzshrc
source ~/.zshrcInstall needed python version with pyenv, it may require some libs for Mint to install before:
pyenv install 3.10.5And now we can configure our project to use the specific version:
mkdir testenv
cd testenv
echo 'layout pyenv 3.10.5' > .envrc
direnv allowCheck version:
python --versionUpdate the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get updatesudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-releaseAdd Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgUse the following command to set up the repository, $(lsb_release -cs) is replaced with bionic:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
bionic stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullUpdate the apt package index, and install the latest version of Docker Engine, containerd, and Docker Compose, or go to the next step to install a specific version:
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin