Windows Subsystem for Linux (WSL): A comprehensive guide for Oracle Linux

Configurare noua (How To)

Situatie

WSL 1: Compatibility Layer

WSL 1 provides a compatibility layer that enables running Linux binary executables natively on Windows by translating Linux system calls into Windows system calls.

Advantages of WSL 1:

  • Ease of setup and use.
  • Low resource consumption compared to traditional virtual machines.
  • Native file system integration with Windows, allowing quick access to files and directories.

WSL 2: Real Linux Kernel

WSL 2 is an upgrade over WSL 1, utilizing a real Linux kernel running in a lightweight virtual machine. This results in enhanced performance and full system call compatibility.

Advantages of WSL 2:

  • Improved performance due to the real Linux kernel.
  • Full system call compatibility, enabling more complex applications and services.
  • Regular kernel updates, ensuring up-to-date features and security patches.

Installation Steps for Oracle Linux on WSL

Here is a step-by-step guide to installing Oracle Linux on your Windows machine using WSL:

  1. Enable the WSL feature via PowerShell: Open PowerShell as an administrator and enter the following command to install WSL and set WSL 2 as the default version:wsl –install

    This command enables the necessary optional components, downloads the latest Linux kernel, sets WSL 2 as the default, and installs a default Linux distribution (usually Ubuntu).

  2. Install Oracle Linux from the Microsoft Store: Since you prefer Oracle Linux, you need to manually install it from the Microsoft Store:
    • Open the Microsoft Store.
    • Search for Oracle Linux.
    • Click Install to download and install the distribution.
  3. Launch Oracle Linux and complete the initial setup: After installation, launch Oracle Linux from the Start menu. The first time you open it, you’ll be prompted to complete the initial setup, which includes creating a new user account and setting a password.

Getting Started with Oracle Linux on WSL

Once Oracle Linux is installed and set up, you can start using Linux commands and tools directly from your Windows environment. Here are a few basic commands to get you started:

  • Update package lists: sudo yum update
  • Upgrade all installed packages: sudo yum upgrade
  • Install a new package (e.g., Git): sudo yum install git
  • Navigate the file system: ls cd /mnt/c/Users/YourUsername/Documents
  • Edit files using a text editor (e.g., Nano): nano hello-world.txt

Switching Between WSL 1 and WSL 2

If you need to switch between WSL 1 and WSL 2, you can do so using the following commands:

  • Set WSL 2 as the default version: wsl –set-default-version 2
  • Convert an existing distribution to WSL 2: wsl –set-version oracle-linux 2
  • Convert an existing distribution to WSL 1: wsl –set-version oracle-linux 1

Solutie

Tip solutie

Permanent

Voteaza

(9 din 17 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?