Giter VIP home page Giter VIP logo

wsl2-rockylinux's Introduction

RockyLinux WSL Image Creator

Rocky Linux WSL Example

This is a simple Windows Subsystem for Linux (WSL) image creator for RockyLinux. Ever since CentOS was changed from being a downstream replica of Red Hat Enterprise Linux (RHEL) to being an upstream source for RHEL, I've been wanting to get a CentOS replacement instance set up to play around with. RockyLinux is one of the CentOS replacements that I've chosen to use for personal projects. Using WSL2 is a perfect solution for running a lightweight Linux VM for testing things, but there isn't an official RockyLinux distribution available in the Microsoft Store. This script will build the barebones RockyLinux image file to use with WSL.

Depending on how far I want to take this, I may also create the code for the UWP app to import the distro. This provides some extra functionality, such as an onboarding portion when starting the WSL VM for the first time. Since I'm not a maintainer of the distro, I wouldn't be publishing it to the Microsoft Store.

In addition, no files of the distro will be distributed through this repo. This is only meant to help create an image of RockyLinux locally.

For more info on how to import a custom Linux distribution for WSL, check out this document from Microsoft.

🧰 Prerequisites

  • A Linux-based Operating System
    • This can be from a physical system, a virtual machine, or another WSL instance on your computer.
  • Packages installed on the system:
    • A container platform.
      • Docker
      • Podman
      • ⚠️ Note: This has been tested with both docker and podman; however, I personally use podman, so there may be some unintentional breakage with docker.

🔨 Build the image

Image building script example

⚠️ Note: If you're intending to run this on an existing WSL instance, I would suggest cloning the repo to Windows and running the script from that location inside of the WSL instance. It will remove the step of copying the output file. For example, it would be located somewhere in /mnt/c/ in the WSL instance (Relative to where you cloned the repo to).

On your Linux host:

  1. Navigate to the cloned repo folder on your local machine in a terminal.
  2. Run ./createRockyLinuxImage.sh
    • If needed, you may need to run chmod +x ./createRockyLinuxImage.sh to allow it to execute.
  3. Once the script finishes, it outputs the file to ./out/rockylinux-latest.tar in the cloned repo directory.

Make sure you copy the rockylinux-latest.tar file to your Windows host.

▶️ Using the image

On your Windows host:

  1. Launch a command prompt or PowerShell console.
  2. Run the following command: wsl.exe --import "RockyLinux" "C:\path\to\dir\" "C:\path\to\rockylinux-latest.tar"
    • The first argument is the name you want to call the distribution.
    • The second argument is the path to store the WSL VM's .vhdx file.
    • The third argument is the path where the .tar file is located.
  3. You can now launch a terminal to the distribution by running wsl.exe --distribution "RockyLinux".

💻 Windows Terminal profile

After importing the distribution, you can add this to your Windows Terminal settings JSON file to make it easier to access (If it doesn't add it automatically).

In the list array under the profiles object, add this to the list:

{
    "guid": "{57929474-3280-5c1a-a51c-b17c2c28a426}",
    "hidden": false,
    "name": "RockyLinux",
    "source": "Windows.Terminal.Wsl"
}

🤔 Things to do after importing

wsl2-rockylinux's People

Contributors

smalls1652 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wsl2-rockylinux's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.