-
How to install a specific version of WSL Ubuntu 22.04 LTS
- Open PowerShell as Administrator.
- Run the command:
wsl --install -d Ubuntu-22.04
. - Follow the on-screen instructions to complete the installation.
-
Update and Upgrade command
- Open your WSL terminal.
- Run the commands:
sudo apt update sudo apt upgrade -y
-
Update the Linux system to not ask for a password 3. Update the Linux system to not ask for a password - Open the sudoers file with the command:
sudo visudo
. - Add the following line at the end of the file:sh sanjay-dev ALL=(ALL) NOPASSWD:ALL
- Save and exit the editor. -
Install oh-my-zsh with Autocomplete and other themes
- Install
zsh
with the command:sudo apt install zsh -y
. - Make
zsh
your default shell:chsh -s $(which zsh)
. - Install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
. - For Autocomplete, install
zsh-autosuggestions
:git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- Enable the plugin by adding
zsh-autosuggestions
to theplugins
array in your.zshrc
file:sed -i 's/plugins=(/plugins=(zsh-autosuggestions /' ~/.zshrc
- Restart your terminal or run
source ~/.zshrc
.
- Install
-
Install Miniconda
- Download and Install Mamba
- Download the Mamba installer for Linux from the official github repo.
- Run the installer with the command:
sh Mambaforge-Linux-x86_64.sh
. - Follow the on-screen instructions to complete the installation.
- Initialize Mamba:
mamba init
. - Alternatively, you can download Mamba using
curl
orwget
:# Using curl
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" bash Miniforge3-$(uname)-$(uname -m).sh
- Download and Install Mamba
-
Install NVIDIA Driver https://docs.nvidia.com/cuda/wsl-user-guide/index.html#cuda-support-for-wsl-2
- Currently below version works in my sytem
Driver Version: 538.95
CUDA Version: 12.2
- Currently below version works in my sytem
Driver Version: 538.95
-
Setup Python environment
- Create a new Conda environment:
mamba create --name myenv python=3.12
. - Activate the environment:
mamba activate myenv
. - Install necessary packages:
mamba install numpy pandas matplotlib
.
- Create a new Conda environment:
-
Install CUDA Toolkit
- Download the CUDA Toolkit from the official NVIDIA website.
- Follow the installation instructions provided on the website for your specific Linux distribution.
- Verify the installation by running:
nvcc --version
.
-
Create a Mamba environment with CUDA GPU support
- Ensure you have the NVIDIA drivers installed on your system.
- Create a new Conda environment with CUDA support:
mamba create -n cuda12-2 python=3.9
. - Activate the environment:
mamba activate cuda12-2
. - Install necessary packages:
mamba install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia
.
*Note at the time of install 12.2 version was not avilable, Pytorch version for cuda 12.2 based on this I installed.
TODO- Setup cuda and install pyturch
- Purpose: Frees up disk space by cleaning up unnecessary files and package caches inside your WSL instance.
- How to Use:
- Place
wsl_disk_cleanup.sh
in your Linux home directory (or any preferred location). - Make it executable:
chmod +x wsl_disk_cleanup.sh
- Run the script:
./wsl_disk_cleanup.sh
- Place
- What to Expect:
The script will:- Clean up package cache with
sudo apt-get clean
- Remove unused packages with
sudo apt-get autoremove
- Clean temporary files and logs
- You will see output messages summarizing freed space and actions taken.
- Clean up package cache with
- Purpose: Shrinks the virtual disk file used by WSL2 to reclaim freed space back on your Windows host.
- How to Use:
- Open PowerShell as Administrator.
- Run:
Optimize-VHD -Path "C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx" -Mode Full
- What to Expect:
This operation may take several minutes. When finished, the ext4.vhdx file will be smaller if there was unused space to reclaim.
- Each WSL distribution has its own vhdx file.
- The path generally looks like:
C:\Users\<YourUsername>\AppData\Local\Packages\<DistroPackageName>\LocalState\ext4.vhdx
- How to Find It:
- List installed WSL distributions:
wsl --list --verbose
- Find the folder in:
Matching your distribution (e.g., contains
%USERPROFILE%\AppData\Local\Packages
Ubuntu22.04LTS
). - The vhdx file is inside that folder’s
LocalState
directory.
- List installed WSL distributions: