Skip to content

⚙️ Sample Document: How to Set Up Your Environment

Depending on your operating system, please follow all the steps presented for your specific system:

Windows

Installing Ubuntu within WSL 2 on Windows

Windows Subsystem for Linux (WSL) allows you to run a full Linux environment without the need for a virtual machine. Below is the guide on how to install Ubuntu on WSL 2.

Step 1: Check System Compatibility

WSL 2 is available on Windows 10, version 1903 and newer, as well as Windows 11. Before starting, ensure your system meets these requirements.

Step 2: Enable WSL

  1. Open PowerShell as Administrator:

    • Right-click on the "Start" button and select "Windows PowerShell (Administrator)" or "Windows Terminal (Administrator)".
  2. Enter the following command to enable WSL:

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    

  3. Now, enable the WSL 2 feature by typing:

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    

  4. Restart your computer to apply the changes.

Step 3: Set WSL 2 as the Default Version

  1. Re-open PowerShell as Administrator.
  2. Set WSL 2 as the default version by typing:
    wsl --set-default-version 2
    

Step 4: Install Ubuntu

  1. Open the Microsoft Store on your computer.
  2. In the search box, type "Ubuntu" and select one of the available versions (e.g., Ubuntu 22.04 LTS).
  3. Click “Install”.

Step 5: Configure Ubuntu

  1. After installation, click “Launch”.
  2. A console will appear to complete the installation. This may take a few moments.
  3. Set your username and password to be used within Ubuntu.

Step 6: Update the System

  1. Launch Ubuntu from the Start menu.
  2. Update packages by entering the following in the terminal:
    sudo apt update
    sudo apt upgrade
    

Congratulations! You have successfully installed and configured Ubuntu within WSL 2 on your Windows computer.

Installing Git in WSL (Windows Subsystem for Linux)

The following instructions show how to install Git on Ubuntu distribution within WSL.

Step 1: Launch Ubuntu

  1. Open the Start menu on your computer.
  2. Search for Ubuntu and click to open the Ubuntu terminal.

Step 2: Update Package Lists

Before installing new packages, ensure that the list of available packages is up to date.

sudo apt update

Step 3: Install Git

After updating the package list, execute the command to install Git.

sudo apt install git

Step 4: Verify Installation

To ensure Git is correctly installed, check its version using the command:

git --version

If Git is installed correctly, you should see the installed version information, such as git version 2.25.1.

Step 5: Configure Git

After installation, set your user information to be used in commit metadata.

  1. Set your username (replace Your Name with your actual name):

    git config --global user.name "Your Name"
    
  2. Set your email address (replace youremail@example.com with your assigned email address):

    git config --global user.email "youremail@example.com"
    

Congratulations! Git is now installed and configured in your WSL environment with Ubuntu.

Installing Docker CE on WSL 2 (Windows Subsystem for Linux 2)

Below are detailed instructions for installing Docker CE on Ubuntu within WSL 2 under Windows.

1. Launch Ubuntu

Start by launching Ubuntu from the Start menu in Windows.

2. Update and Prepare the System

In the Ubuntu terminal, enter the following commands to update the system and install necessary packages:

sudo apt update && sudo apt upgrade
sudo apt install --no-install-recommends apt-transport-https ca-certificates curl gnupg2

3. Configure iptables

Configure iptables by entering:

sudo update-alternatives --config iptables

4. Add Docker GPG Key and Repository

Add Docker's GPG key and repository by executing:

. /etc/os-release
curl -fsSL https://download.docker.com/linux/${ID}/gpg | sudo tee /etc/apt/trusted.gpg.d/docker.asc
echo "deb [arch=amd64] https://download.docker.com/linux/${ID} ${VERSION_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update

5. Install Docker CE

Now install Docker CE and its components:

sudo apt install docker-ce docker-ce-cli containerd.io

6. Add User to Docker Group

To access Docker without administrative privileges, add your user to the "docker" group:

sudo usermod -aG docker $USER

7. Restart the WSL Environment

To apply changes, restart WSL:

  1. Close all WSL terminal windows.
  2. Restart the WSL terminal, logging into your account.

After these steps, Docker CE should be properly installed and ready to use in the WSL 2 environment. You can verify this by entering in the terminal:

docker --version

Linux/macOS

Instructions to Install Git on Linux

Step 1: Open Terminal

Open the terminal on your Linux system. You can do this by using the Terminal application in the app menu or using a keyboard shortcut (e.g., Ctrl + Alt + T for Ubuntu).

Step 2: Update Package Lists

Before installing new software, it’s advisable to update the list of available packages. Enter the following command and press Enter:

sudo apt update

Step 3: Install Git

Now we can install Git. Enter the following command and press Enter:

sudo apt install git

Step 4: Confirm Installation

During installation, you may need to confirm. Press Y and Enter to continue when prompted.

Step 5: Check Git Version

After installation, you can check if Git was installed correctly by typing:

git --version

You should see the installed version of Git, such as: git version 2.34.1.

Step 6: Configure Git

Finally, it’s useful to configure basic user settings for Git. Use the following commands to set your name and email (remember to replace Name and Surname with your name and your email with your business email):

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"

That's it! You have installed and configured Git on your Linux system.

Installing Docker CE on Linux

  1. Open Terminal

    Open the terminal on your Linux system to begin the Docker installation.

  2. Update Package Lists and Install Available Updates

    sudo apt-get update -y && sudo apt-get upgrade -y
    
  3. Install Required Packages

    For Docker to be installed correctly, you need a few additional packages:

    sudo apt-get install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -y
    
  4. Add Docker's GPG Key

    Download and add Docker's official GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  5. Add Docker CE Repository

    Add Docker's official repository to APT:

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    
  6. Install Docker CE

    After adding the repository, install Docker CE and additional components:

    sudo apt-get install docker-ce docker-ce-cli containerd.io -y
    
  7. Enable and Start Docker Service

    Ensure Docker is enabled and running:

    sudo systemctl enable docker && sudo systemctl start docker
    
  8. Add User to Docker Group

    To run Docker commands without using sudo, add your user to the Docker group:

    sudo usermod -aG docker $USER
    
  9. Finish

    Log out and log back in for changes regarding user group membership to take effect.

Done! Your Docker CE should now be installed and ready to use on your Linux system.