Skip to content

malekifar/ubuntu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hits

How to install Ubuntu 20.04 + VScode + Anaconda + Git + ZSH

Table of Contents

Installing

Method1 Using Ubuntu's Advanced Packaging (APT)

Open Terminal and Type the following command to install Visual Studio Code:

sudo apt update && sudo apt install software-properties-common curl apt-transport-https && cd /tmp && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ && sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' && sudo apt update && sudo apt install code
Method2 Using Snap
sudo snap install --classic code

Configuring

To edit your VS Code configuration in JSON, open the command palette (Go to View -> Command Palette, or Press Ctrl + Shift + P), type Open Settings JSON and select Preferences: Open Settings (JSON):

search setting.json

The settings.json file with all the non-default VS Code settings will open:

setting.json

You can use these additional settings:

"editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.renderWhitespace": "all",
"diffEditor.ignoreTrimWhitespace": false,
"update.mode": "none",
"extensions.autoUpdate": false,
"window.title": "[${folderName}]${separator}${dirty}${activeEditorShort}${separator}${appName}",
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2
  • editor.wordSeparators: I removed the — from the word separators so I can select identifiers with a — in it via double-click on a word (sometimes these can be used in bash scripts)
  • editor.renderWhitespace: I always want to see all the spaces in my source files
  • diffEditor.ignoreTrimWhitespace : when I do a git merge, I want to see the differences due to space changes
  • update.mode and extensions.autoUpdate: I don’t want the extensions to autoupdate, I need to control when they are updated as sometimes with WSL they break
  • window.title : I added the [foldername] to the beginning of the window title, so I can recognize different go projects instances by their folder names (I can have 5 or 6 open at the same time, this is a saviour!)
  • files.trimTrailingWhitespace : when a file is saved, all the extra spaces at the end of a line are trimmed out
  • editor.tabSize: I like to use 2 spaces for tabs

Add the ones you want to use to your settings.json file and save it:

addedsetting.json

Install an extension

To install an extension, select the Install button. Once the installation is complete, the Install button will change to the Manage gear button.

Install an extension

Extensions

VSCode has many extensions. You can find a list of pre-installed extensions at here

Best Extensions

Installing

Type the following command to download Anaconda in tmp folder and install it then press Enter:

Silent Mode(recommended)

  • For x86:
sudo apt install curl && cd /tmp && curl https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh --output anaconda.sh && bash anaconda.sh -b -p $HOME/anaconda
  • For ARM64:
sudo apt install curl && cd /tmp && curl https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-aarch64.sh --output anaconda.sh && bash anaconda.sh -b -p $HOME/anaconda

Normally Mode

  • For x86:
sudo apt install curl && cd /tmp && curl https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh --output anaconda.sh && bash anaconda.sh
  • For ARM64:
sudo apt install curl && cd /tmp && curl https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-aarch64.sh --output anaconda.sh && bash anaconda.sh

You’ll receive these following outputs in normally mode:

Output:

Welcome to Anaconda3 2021.05

In order to continue the installation process, please review the license agreement
Please, press ENTER to continue

Press Enter to continue and then press Enter to read through the license. Once you’re done reading the license, you’ll be prompted to approve the license terms:

Output:

Do you approve the license terms? [yes|no]

As long as you agree, type yes.

Output:

Anaconda3 will now be installed into this location:
/home/usename/anaconda3

  • Press ENTER to confirm the location
  • Press CTRL-C to abort the installation
  • Or specify a different location below

[/home/username/anaconda3] >>>

At this point, you’ll be prompted to choose the location of the installation. You can press Enter to accept the default location, or specify a different location to modify it.

output:

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>>

Type yes so that you can initialize Anaconda3. You’ll receive some output that states changes made in various directories. One of the lines you receive will thank you for installing Anaconda.

Output:

Thank you for installing Anaconda3!

Conda init

source ~/anaconda3/etc/profile.d/conda.sh ; source ~/anaconda/etc/profile.d/conda.sh ; conda init bash 

Install Git using apt-get:

sudo apt-get update && sudo apt-get install git

Installing

Type the following commands to update apt and install zsh then press Enter:

sudo apt update -y && sudo apt install -y zsh

Now set zsh to be your default shell: this command reboot your computer

chsh -s $(which zsh) ; sudo sed -i 's/\/usr\/bin\/bash/\/usr\/bin\/zsh/g' /etc/passwd ; sudo sed -i 's/\/bin\/bash/\/bin\/zsh/g' /etc/passwd ; reboot

Open a new terminal and the initial zsh prompt will show up, signaling that zsh is now the default shell. At this point pick 2 — it will populate the zsh configuration file ~/.zshrc with defaults.

Let’s check again that zsh is the default shell:

output:

/usr/bin/zsh
zsh 5.8 (x86_64-ubuntu-linux-gnu)

Installing oh-my-zsh

Now we can install oh-my-zsh

sudo apt install -y curl && sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Notice that oh-my-zsh updated your ~/.bashrc file and made a backup of the old one. Also notice that the prompt changed now, it is just your username.

OK, we are readty to customize oh-my-zsh next.

Conda init

source ~/anaconda3/etc/profile.d/conda.sh ; source ~/anaconda/etc/profile.d/conda.sh ; conda init zsh

ZSH Plugins

Oh-My-ZSH has many plugins. You can find a list of pre-installed plugins at here

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.zsh/.fzf && ~/.zsh/.fzf/install
git clone git://github.com/wting/autojump.git ~/.zsh/autojump && cd ~/.zsh/autojump && ./install.py && echo "source ~/.autojump/etc/profile.d/autojump.sh" >> ~/.zshrc && pkill terminal
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && echo "source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
git clone https://github.com/b4b4r07/enhancd ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/enhancd && echo "source ~/.oh-my-zsh/custom/plugins/enhancd/init.sh" >> ~/.zshrc
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions && echo "source ~/.oh-my-zsh/custom/plugins/zsh-completions/zsh-completions.plugin.zsh" >> ~/.zshrc
git clone https://github.com/zdharma/fast-syntax-highlighting ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting && echo "source ~/.oh-my-zsh/custom/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" >> ~/.zshrc
sed -i 's/plugins=\(.*\)/plugins=\(git docker zsh-completions colored-man-pages fast-syntax-highlighting colorize dash command-not-found extract\)/g' ~/.zshrc

ZSH Fonts

cd /tmp && wget https://github.com/malekifar/ubuntu/releases/download/v1.0/Fonts.zip -O Fonts.zip && unzip Fonts.zip && sudo bash install.sh

Color Schemes

sudo apt-get install dconf-cli uuid-runtime && bash -c "$(wget -qO- https://git.io/vQgMr)"

Type ALL to installing all color schemes. You can change color scheme by changing profile in terminal.

ZSH Themes

We are going to make our color pretty and prompt useful. There are a lot of themes in oh-my-zsh, you can see them here:

PowerLevel10K(recommended)
  • Installing
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  • Enabling
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/g' ~/.zshrc
  • Configuring To run Powerlevel10k configuration wizard again, type the following commands:
p10k configure

powerlevel10k

Agnoster
  • Enabling
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="agnoster"/g' ~/.zshrc
  • Hiding computer name
echo "export DEFAULT_USER=$(whoami)" >> ~/.zshrc

Agnoster

robbyrussell
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="robbyrussell"/g' ~/.zshrc

robbyrussell

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Languages