Skip to content

Commit 51422d8

Browse files
committed
updated wsl2 copy
Signed-off-by: bidi47 <bidi@apidemia.com>
1 parent 774eb82 commit 51422d8

1 file changed

Lines changed: 49 additions & 19 deletions

File tree

‎public/wsl2.md‎

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Development Environment | AlmaLinux 10 on WSL 2"
3-
description: "AlmaLinux 10 on WSL 2 for a RHEL-compatible local stack. One Ansible playbook installs PHP, Apache, MariaDB, Composer, Node.js and phpMyAdmin, and provisions a virtualhost for every project you add."
3+
description: "AlmaLinux 10 on WSL 2 for a RHEL-compatible local stack. One Ansible playbook installs PHP, Apache, MariaDB, Composer, Node.js and phpMyAdmin, and a second provisions a virtualhost for every project you add."
44
canonical_url: "https://www.dotkernel.com/wsl2/"
55
language: "en"
66
---
@@ -30,7 +30,8 @@ Terminal -> WSL 2 -> AlmaLinux -> Ansible -> Ready.
3030
AlmaLinux is a RHEL-compatible distribution, so the packages, package manager and service conventions you use locally - `dnf`, `systemd` and the rest - are the ones you will see again in staging and production.
3131
WSL 2 puts that distro on a Windows machine without a second computer or a Windows-native rebuild of every tool.
3232

33-
Everything here also runs the same way without WSL, directly on a bare AlmaLinux 10 host - the Ansible playbooks do not know or care which one they are provisioning.
33+
Everything from Setup Packages onwards also runs on a bare AlmaLinux 10 host without WSL - the Ansible playbooks do not know or care which one they are provisioning.
34+
Connect over SSH, and use the server's IP address instead of `localhost` when you test it.
3435

3536
- RHEL-compatible, matches production
3637
- One playbook, the whole stack
@@ -39,15 +40,16 @@ Everything here also runs the same way without WSL, directly on a bare AlmaLinux
3940

4041
## Three steps to a running shell
4142

42-
Each step runs in a different place - Windows Terminal for the first two, the AlmaLinux 10 shell for the third.
43+
Steps 1 and 2 run in Windows Terminal and step 3 in the AlmaLinux 10 shell; step 2 ends inside the new distro with a quick systemd check.
4344
The full walkthrough, prompts and all, is in the docs.
4445

4546
### 1 . Terminal & requirements
4647

47-
Install Windows Terminal, then confirm WSL 2 is enabled - Hyper-V, Virtual Machine Platform and Windows Subsystem for Linux, all turned on in Windows features.
48+
On Windows 11, install Windows Terminal, then check for a modern WSL 2 install.
49+
If `wsl --version` isn't recognized, install WSL 2 with `wsl --install --no-distribution` and restart when prompted.
4850

4951
```shell
50-
wsl -v
52+
wsl --version
5153
```
5254

5355
### 2 . Install AlmaLinux 10
@@ -58,15 +60,25 @@ Stop any other running distro, then install AlmaLinux 10 and create your Unix us
5860
wsl --install -d AlmaLinux-10
5961
```
6062

63+
Before moving on, confirm systemd is active inside AlmaLinux 10 - the playbook needs it.
64+
If the check below prints an error instead of a status, add `systemd=true` under `[boot]` in `/etc/wsl.conf`, run `wsl --shutdown` from Windows Terminal and reopen the distro.
65+
66+
```shell
67+
systemctl is-system-running
68+
```
69+
6170
### 3 . Setup packages
6271

63-
Clone `dotkernel/development`, fill in `config.yml` with your Git identity and MariaDB root password, and let Ansible provision the rest.
72+
Inside AlmaLinux 10, update the system, add the EPEL and Remi repositories, and install `ansible-core` with the `community.general` and `community.mysql` collections.
73+
Then clone the `alma-linux-10` branch of `dotkernel/development`, copy `wsl/config.yml.dist` to `config.yml`, fill in your Git identity and MariaDB root password, and run the playbook from `development/wsl`.
6474

6575
```shell
6676
ansible-playbook -i hosts install.yml --ask-become-pass
6777
```
6878

69-
Not using WSL? Skip straight to Setup Packages on a bare AlmaLinux 10 host - the same playbook runs there unchanged.
79+
Not using WSL? Skip straight to Setup Packages on a bare AlmaLinux 10 host - the same playbook runs there unchanged; test it with the server's IP address instead of `localhost`.
80+
81+
After setup, [Editor Integration](https://docs.dotkernel.org/development/v2/editor-integration/) connects VS Code or PhpStorm, and [WSL Configuration](https://docs.dotkernel.org/development/v2/wsl-configuration/) covers where to keep projects and how to cap WSL's memory and CPU.
7082

7183
## What one playbook installs
7284

@@ -75,27 +87,28 @@ Not using WSL? Skip straight to Setup Packages on a bare AlmaLinux 10 host - the
7587
| Component | What you get |
7688
| --- | --- |
7789
| Web server | Apache, with virtualhosts routed automatically under `*.localhost`. |
78-
| Database | MariaDB 11.4 LTS, plus phpMyAdmin for browsing it. |
79-
| PHP | 8.4 by default via the Remi repository; `php81` … `php85` aliases switch versions. |
90+
| Database | MariaDB 12.3 from the MariaDB repository, plus phpMyAdmin for browsing it. |
91+
| PHP | 8.5 by default via the Remi repository; `php81` … `php85` aliases switch versions. |
8092
| Node.js | 22 by default via NodeSource; `node18` … `node24` aliases switch versions. |
81-
| Git & Composer | Your Git identity from `config.yml`, and the latest Composer, kept current with `composer self-update`. |
82-
| Ansible | `community.general` and `community.mysql` collections - the same tool that just installed itself. |
93+
| Git & Composer | Your Git identity from `config.yml`, and the latest Composer at install time; update it later with `composer self-update`. |
8394

8495
## Every project, its own subdomain
8596

8697
`api.dotkernel.localhost` and `frontend.dotkernel.localhost` can point at two different projects on the same machine, and Apache routes both without a single edit to the Windows hosts file - any `*.localhost` domain is routed automatically.
8798

88-
List the domains you want under `config.yml`'s `virtualhosts` key and run the playbook.
99+
List the domains you want under `config.yml`'s `virtualhosts` key and run `create-virtualhost.yml` - a separate playbook you re-run for every new project, without repeating `install.yml`.
89100
Existing entries are left untouched, so you keep adding to the same file as your project grows.
90101

91102
- [Read the virtualhosts docs](https://docs.dotkernel.org/development/v2/virtualhosts/overview/)
92103

93104
### One playbook, every domain
94105

95-
In `development/wsl/config.yml`, under `virtualhosts`:
106+
In `development/wsl/config.yml`, under `config.virtualhosts`:
96107

97-
```text
98-
api.dotkernel.localhost
108+
```yaml
109+
config:
110+
virtualhosts:
111+
- "api.dotkernel.localhost"
99112
```
100113
101114
Then provision it:
@@ -105,6 +118,7 @@ ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass
105118
```
106119

107120
Files go under `/var/www/api.dotkernel.localhost/html`, with the document root at `html/public`.
121+
`html/public` doesn't exist until you place a project there, so the URL shows an error until then.
108122

109123
## Common questions
110124

@@ -121,10 +135,11 @@ Use one of the predefined aliases - `node18`, `node20`, `node22` or `node24` - w
121135
### How do I fix permission issues?
122136

123137
Local development only: `chmod -R 777 data`, `log` or `public/uploads`, whichever directory the error names.
138+
Don't carry this into staging or production.
124139

125140
### Where are the error logs?
126141

127-
Apache: `/var/log/httpd/error_log`. PHP-FPM: `/var/log/php-fpm/error.log` and `www-error.log`.
142+
Apache: `/var/log/httpd/error_log`, plus `/var/www/<virtualhost>/log/error.log` for each virtualhost. PHP-FPM: `/var/log/php-fpm/error.log` and `www-error.log`.
128143

129144
### How do I update Composer?
130145

@@ -138,14 +153,29 @@ Add `alias name="command"` to `.bash_profile` in your home directory, then run i
138153

139154
Remove its folder under `/var/www/`, its Apache config and enabled-site symlink, then `sudo systemctl restart httpd`.
140155

156+
### Why does the playbook fail with a systemd error?
157+
158+
systemd isn't active in the distro yet.
159+
Add `systemd=true` under `[boot]` in `/etc/wsl.conf`, run `wsl --shutdown` from Windows Terminal, reopen AlmaLinux 10 and re-run `install.yml`.
160+
161+
### What if port 80 is already in use?
162+
163+
Find the Windows service holding it with `netstat -ano | findstr :80` and stop it, or change Apache's `Listen` port in `/etc/httpd/conf/httpd.conf` and restart httpd.
164+
165+
### Is this environment safe to expose beyond localhost?
166+
167+
No. It is for local development only: the MariaDB root password is stored in plaintext, phpMyAdmin allows root login and the firewall is off by default.
168+
141169
### Can I run this without WSL?
142170

143-
Yes - every instruction here works the same way on a bare AlmaLinux 10 host.
171+
Yes - from Setup Packages onwards the steps are the same on a bare AlmaLinux 10 host.
172+
Skip the WSL steps, connect over SSH, and use the server's IP address instead of `localhost`.
144173

145-
## Provision once, match production everywhere.
174+
## Provision once, match your production OS
146175

147176
Built for how the platform ships.
148177

149-
The WSL 2 + AlmaLinux 10 setup is maintained by the same team behind the rest of the Headless Platform, so the local environment stays in step with what actually runs in production - not a Docker approximation of it.
178+
The WSL 2 + AlmaLinux 10 setup is maintained by the same team behind the rest of the Headless Platform, so the local environment stays on the same OS family as production - not a Docker approximation of it.
179+
It is a local development environment only: security is relaxed by default, so never expose it to a network.
150180

151181
[Talk to us ->](https://www.dotkernel.com/contact/)

0 commit comments

Comments
 (0)