Skip to content

ii00/FreshMint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

FreshMint

Setup after newly installed Linux Mint:

zsh and oh my zsh

nvm

github ssh

direnv python

pyenv

docker

zsh and oh my zsh

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 -y

Zsh is already available in Linux Mint 20 repository making it easy to install. Run the command below:

sudo apt-get install zsh -y

Check the installed version to confirm Zsh installation:

zsh –version

Once installed, change the default shell of root user to zsh by running the below command:

sudo chsh -s /usr/bin/zsh $USER

Now 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 $SHELL

As 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 git

Now down and execute Oh-My-Zsh installer script:

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

The output should be as below:

alt text

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 ~/.zshrc

Check available themes. The current default theme provided by Oh-My-Zsh is ‘robbyrusell‘ theme.:

cd ~/.oh-my-zsh/themes/
ls -a

To 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 -a

To 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/forgit

nvm

It's recommended installing node and npm using nvm.

Then:

nvm install node

github ssh

The -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_rsa

Log 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.

direnv python

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 | bash

First 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 ~/.zshrc

This 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' > .envrc

pyenv

pyenv 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 | bash

And 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 ~/.zshrc

Install needed python version with pyenv, it may require some libs for Mint to install before:

pyenv install 3.10.5

And now we can configure our project to use the specific version:

mkdir testenv
cd testenv
echo 'layout pyenv 3.10.5' > .envrc
direnv allow

Check version:

python --version

docker

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Use 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/null

Update 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 update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

About

FreshMint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published