|
1 | 1 | # Custom WSL OS
|
2 | 2 |
|
3 |
| -[](https://img.shields.io/github/license/gvatsal60/project-template) |
4 |
| -[](https://github.com/gvatsal60/project-template/actions/workflows/readme-checker.yaml) |
5 |
| -[](https://results.pre-commit.ci/latest/github/gvatsal60/project-template/HEAD) |
6 |
| - |
7 |
| - |
8 |
| - |
9 |
| - |
10 |
| - |
11 |
| -This repository serves as a foundational template for new projects, equipped with essential tools for |
12 |
| -maintaining code quality and documentation consistency. It includes: |
13 |
| - |
14 |
| -1. README.md |
15 |
| -2. LICENSE |
16 |
| -3. .gitignore |
17 |
| -4. CODE_OF_CONDUCT.md |
18 |
| -5. CONTRIBUTING.md |
19 |
| -6. FUNDING.yml |
20 |
| -7. CHANGELOG.md |
21 |
| - |
22 |
| -## Installation |
23 |
| - |
24 |
| -To install Project Template, follow these steps: |
25 |
| - |
26 |
| -1. **Customize According to Your Project:** |
27 |
| - * Replace `[Project Name]` |
28 |
| - * Update `[contact email]` |
29 |
| - * Follow `[coding style guide]` |
30 |
| - |
31 |
| -## Build Image |
32 |
| -```bash |
33 |
| -docker compose build |
34 |
| -``` |
| 3 | +[](https://img.shields.io/github/license/gvatsal60/Custom-WSL-OS) |
| 4 | +[](https://github.com/gvatsal60/Custom-WSL-OS/actions/workflows/docker-img-push.yaml) |
| 5 | +[](https://results.pre-commit.ci/latest/github/gvatsal60/Custom-WSL-OS/HEAD) |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +Welcome! This guide will walk you through the process of setting up Windows Subsystem for Linux (WSL) with a custom image. |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +1. Windows Version: Ensure you're running Windows 10 version 1903 or later, or Windows 11 |
| 16 | + |
| 17 | +2. WSL Installed: If you haven't installed WSL yet, follow the instructions on Microsoft's official [WSL documentation](https://learn.microsoft.com/en-us/windows/wsl/install) before proceeding |
| 18 | + |
| 19 | +3. Custom Ubuntu Image: You should have your custom Ubuntu image ready in .tar format |
| 20 | + |
| 21 | +4. Docker: Ensure Docker and Docker Compose are installed on your system. Follow Docker’s [installation instructions](https://docs.docker.com/engine/install/) if you haven't installed Docker yet. |
| 22 | + |
| 23 | +### Steps for Installation |
| 24 | + |
| 25 | +1. Install WSL and Ubuntu |
| 26 | + |
| 27 | + If you haven’t already installed WSL, you can do so with the following steps: |
| 28 | + |
| 29 | + 1. Open PowerShell as Administrator: |
| 30 | + Right-click the Start menu and select "Windows PowerShell (Admin)" |
| 31 | + |
| 32 | + 2. Install WSL: |
| 33 | + |
| 34 | + ```sh |
| 35 | + wsl --install |
| 36 | + ``` |
| 37 | + |
| 38 | + This command will install the WSL feature and download the default Linux distribution. |
| 39 | + |
| 40 | + 3. Restart Your Computer: |
| 41 | + A restart may be required for the WSL feature to be fully installed. |
| 42 | + |
| 43 | +2. Download and Install the Custom Ubuntu Image |
| 44 | + |
| 45 | + 1. Open PowerShell as Administrator: |
| 46 | + |
| 47 | + - Ensure you're running PowerShell with administrative privileges. |
| 48 | +
|
| 49 | + 2. Import the Custom Image: |
| 50 | +
|
| 51 | + - Replace `path\to\your\custom-image.tar` with the path to your custom Ubuntu .tar image and YourCustomUbuntu with a name for your WSL instance. |
| 52 | +
|
| 53 | + ```sh |
| 54 | + wsl --import YourCustomUbuntu path\to\installation\folder path\to\your\custom-image.tar |
| 55 | + ``` |
| 56 | +
|
| 57 | + - YourCustomUbuntu: The name you assign to your WSL instance. |
| 58 | +
|
| 59 | + - `path\to\installation\folder`: Directory where you want to store the WSL instance. For example, `C:\WSL\YourCustomUbuntu` |
| 60 | +
|
| 61 | + 3. Set Default Distribution (Optional): |
| 62 | +
|
| 63 | + - If you want to make your custom image the default WSL distribution, run: |
| 64 | +
|
| 65 | + ```sh |
| 66 | + wsl --set-default YourCustomUbuntu |
| 67 | + ``` |
| 68 | +
|
| 69 | + 4. Launch Your Custom Ubuntu Instance: |
| 70 | +
|
| 71 | + You can now start your custom Ubuntu instance with: |
| 72 | +
|
| 73 | + ```sh |
| 74 | + wsl -d YourCustomUbuntu |
| 75 | + ``` |
| 76 | +
|
| 77 | +3. Verify the Installation |
| 78 | +
|
| 79 | + 1. Check WSL Versions: |
| 80 | +
|
| 81 | + - To verify that your custom image is installed and recognized, you can list your WSL distributions: |
| 82 | +
|
| 83 | + ```sh |
| 84 | + wsl -l -v |
| 85 | + ``` |
| 86 | +
|
| 87 | + This command will list all installed WSL distributions and their versions. |
| 88 | +
|
| 89 | + 2. Verify Ubuntu Version: |
| 90 | +
|
| 91 | + - Inside your WSL terminal, check the Ubuntu version to ensure it’s correctly installed: |
| 92 | +
|
| 93 | + ```sh |
| 94 | + lsb_release -a |
| 95 | + ``` |
| 96 | +
|
| 97 | +4. Troubleshooting |
| 98 | +
|
| 99 | + - Custom Image Issues: If you encounter issues with your custom image, ensure that the .tar file is valid and not corrupted. You might need to recreate or download a fresh version. |
| 100 | +
|
| 101 | + - Permissions: Ensure you have the necessary permissions for the directory where you are installing the WSL instance. |
| 102 | +
|
| 103 | + - Update WSL: Make sure your WSL installation is up-to-date: |
| 104 | +
|
| 105 | + ```sh |
| 106 | + wsl --update |
| 107 | + ``` |
| 108 | +
|
| 109 | +5. Build and Run with Docker Compose |
| 110 | +
|
| 111 | + Open a terminal (PowerShell or Command Prompt) and navigate to the directory containing docker-compose.yml. |
| 112 | +
|
| 113 | + Build and run the Docker containers: |
| 114 | +
|
| 115 | + ```sh |
| 116 | + docker-compose up --build |
| 117 | + ``` |
| 118 | +
|
| 119 | + This command will build the Docker image according to the Dockerfile and start the container as specified in docker-compose.yml. |
| 120 | +
|
| 121 | +## Additional Resources |
| 122 | +
|
| 123 | +[Microsoft WSL Documentation](https://docs.microsoft.com/en-us/windows/wsl/) |
| 124 | +
|
| 125 | +[Ubuntu WSL Guide](https://ubuntu.com/wsl) |
| 126 | +
|
| 127 | +[Troubleshooting WSL](https://docs.microsoft.com/en-us/windows/wsl/install-troubleshoot) |
35 | 128 |
|
36 | 129 | ## Contributing
|
37 | 130 |
|
38 | 131 | Contributions are welcome! Please read our
|
39 |
| -[Contribution Guidelines](https://github.com/gvatsal60/project-template/blob/HEAD/CONTRIBUTING.md) |
| 132 | +[Contribution Guidelines](https://github.com/gvatsal60/Custom-WSL-OS/blob/HEAD/CONTRIBUTING.md) |
40 | 133 | before submitting pull requests.
|
41 | 134 |
|
42 | 135 | ## License
|
43 | 136 |
|
44 | 137 | This project is licensed under the Apache License 2.0 License - see the
|
45 |
| -[LICENSE](https://github.com/gvatsal60/project-template/blob/HEAD/LICENSE) file for details. |
| 138 | +[LICENSE](https://github.com/gvatsal60/Custom-WSL-OS/blob/HEAD/LICENSE) file for details. |
0 commit comments