Skip to content

Commit 6d85a71

Browse files
authored
Merge pull request #135 from dotkernel/docs/fix-landing-page
Rewrite the landing page and shrink the duplicated wsl/ install guide
2 parents ecff4a2 + e6ca476 commit 6d85a71

2 files changed

Lines changed: 22 additions & 298 deletions

File tree

‎README.md‎

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,29 @@
1-
# WSL2 development environment
1+
# Development environment
22

3-
This is a collection of Ansible scripts helping with the creation and maintenance of your WSL2 development environment.
3+
This repo provisions a full local development environment for any PHP framework or project, using an Ansible playbook, runnable directly on Linux or inside WSL 2 on Windows.
44

5-
If you're not already using it, we recommend you to install [Windows Terminal](https://apps.microsoft.com/detail/9n0dx20hk701?hl=en-US&gl=US).
6-
It is a modern tool that incorporates the power of multiple already known command-line applications like `Windows PowerShell`, `Linux shell`, and more...
5+
## What you get
76

8-
## Check if WLS2 is already available
7+
Running the playbook installs and configures:
98

10-
Open `Windows Terminal` and execute the following command:
9+
* Apache
10+
* PHP-FPM (version pinned in `wsl/roles/php/tasks/main.yml`)
11+
* MariaDB (version pinned in `wsl/roles/mariadb/templates/MariaDB.repo.j2`)
12+
* phpMyAdmin
13+
* Composer
14+
* Node.js 22
1115

12-
```shell
13-
wsl -v
14-
```
16+
## Which version should I use?
1517

16-
The output should look similar to this:
18+
Two versions of this guide are maintained:
1719

18-
```text
19-
WSL version: 2.2.4.0
20-
Kernel version: 5.15.153.1-2
21-
WSLg version: 1.0.61
22-
MSRDC version: 1.2.5326
23-
Direct3D version: 1.611.1-81528511
24-
DXCore version: 10.0.26091.1-240325-1447.ge-release
25-
Windows version: 10.0.22631.3737
26-
```
20+
* **v2** targets **AlmaLinux 10** and is the current, actively maintained version - start here unless you have a specific reason not to.
21+
* **v1** targets **AlmaLinux 9**, for environments that haven't moved to AlmaLinux 10 yet.
2722

28-
If the output starts with `WSL version: 2.x.x.x`, you are ready to use **WSL2** and can proceed to [install AlmaLinux 10](wsl/README.md).
23+
## Getting started
2924

30-
## Install WSL2
25+
Full documentation is published at <https://docs.dotkernel.org/development/v2/>.
3126

32-
Before proceeding with the installation, please consult Microsoft's [documentation](https://learn.microsoft.com/en-us/windows/wsl/install#prerequisites) regarding the minimum requirements for running WSL2.
27+
If you're using WSL 2 (Windows Subsystem for Linux) to run your development environment, start with [Terminal](https://docs.dotkernel.org/development/v2/terminal/) to install Windows Terminal, then continue to [System Requirements](https://docs.dotkernel.org/development/v2/setup/system-requirements/).
3328

34-
Once you identified that your machine can run WSL2, open the `Run` prompt by pressing `Win` + `r`, type `OptionalFeatures` in the dialog and press `Enter`.
35-
This will open a window where you can turn Windows features on/off.
36-
Make sure that the below features are activated (checked):
37-
38-
* `Hyper-V` (including its sub-features)
39-
* `Virtual Machine Platform`
40-
* `Windows Subsystem for Linux`
41-
42-
> If any of the above features are missing, then first you need to install them manually using [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps.
43-
44-
Click `Ok` and restart your computer.
45-
46-
Open Microsoft Store, search for `Windows Subsystem for Linux` and install it.
47-
48-
Make sure that version **2** of WSL is set as default by executing the below command in Windows Terminal:
49-
50-
```shell
51-
wsl --set-default-version 2
52-
```
53-
54-
To test, run again the following command:
55-
56-
```shell
57-
wsl -v
58-
```
59-
60-
This time the output should display `WSL version: 2.x.x.x`, which means that your system is ready for using **WSL2** and you can proceed to [install AlmaLinux 10](wsl/README.md).
29+
If you're not using WSL (for example, a native Linux host), you can jump straight to [Setup Packages](https://docs.dotkernel.org/development/v2/setup/setup-packages/).

‎wsl/README.md‎

Lines changed: 4 additions & 249 deletions
Original file line numberDiff line numberDiff line change
@@ -1,251 +1,6 @@
1-
# AlmaLinux 10 Installation
1+
# WSL 2 development environment
22

3-
Before proceeding with the installation, we need to make sure that no other WSL2 distribution (aka: _distro_) is running.
4-
This is important because this installation will fail if required ports are already in use by another distro.
3+
This folder contains the Ansible playbook used to provision a local development environment (Apache, PHP-FPM, MariaDB, phpMyAdmin, Composer, and Node.js).
4+
It runs directly on Linux or via WSL 2 on Windows, and is designed for development in any PHP framework or project.
55

6-
Open `Windows Terminal`.
7-
8-
## Stop other WSL2 distros
9-
10-
List all installed distros:
11-
12-
```shell
13-
wsl -l -v
14-
```
15-
16-
If there is no other distro installed, you will see the below output (an empty list):
17-
18-
```text
19-
NAME STATE VERSION
20-
```
21-
22-
In this case, you can jump to the [installation](#install-almalinux-10) section.
23-
24-
If you have other distros installed, the output could look similar to the below:
25-
26-
```text
27-
NAME STATE VERSION
28-
AlmaLinux-8 Stopped 2
29-
* AlmaLinux-9 Running 2
30-
```
31-
32-
Make sure that the **STATE** column reads **Stopped** for all distros.
33-
If any of them reads **Running**, you must stop if first by executing `wsl -t <distro-name>` after replacing `<distro-name>` with the name of the distro you want to stop.
34-
Once you have stopped all distros, you can continue to the [installation](#install-almalinux-10) section.
35-
36-
## Install AlmaLinux 10
37-
38-
List the available Linux distros by executing:
39-
40-
```shell
41-
wsl --list --online
42-
```
43-
44-
Depending on the list of distros available at the moment you run the command, the output should look similar to the below:
45-
46-
```text
47-
The following is a list of valid distributions that can be installed.
48-
Install using 'wsl.exe --install <Distro>'.
49-
50-
NAME FRIENDLY NAME
51-
AlmaLinux-8 AlmaLinux OS 8
52-
AlmaLinux-9 AlmaLinux OS 9
53-
AlmaLinux-Kitten-10 AlmaLinux OS Kitten 10
54-
AlmaLinux-10 AlmaLinux OS 10
55-
Debian Debian GNU/Linux
56-
FedoraLinux-42 Fedora Linux 42
57-
SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5
58-
SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
59-
Ubuntu Ubuntu
60-
Ubuntu-24.04 Ubuntu 24.04 LTS
61-
archlinux Arch Linux
62-
kali-linux Kali Linux Rolling
63-
openSUSE-Tumbleweed openSUSE Tumbleweed
64-
openSUSE-Leap-15.6 openSUSE Leap 15.6
65-
Ubuntu-18.04 Ubuntu 18.04 LTS
66-
Ubuntu-20.04 Ubuntu 20.04 LTS
67-
Ubuntu-22.04 Ubuntu 22.04 LTS
68-
OracleLinux_7_9 Oracle Linux 7.9
69-
OracleLinux_8_7 Oracle Linux 8.7
70-
OracleLinux_9_1 Oracle Linux 9.1
71-
```
72-
73-
Note the two columns: **NAME** and **FRIENDLY NAME**.
74-
To install a specific distro, use the value from the **NAME** column, in this case: `AlmaLinux-10`.
75-
76-
> If you try to install a distro that is already installed, the installation process will fail:
77-
78-
```text
79-
Downloading: AlmaLinux OS 10
80-
Installing: AlmaLinux OS 10
81-
A distribution with the supplied name already exists. Use --name to choose a different name.
82-
Error code: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS
83-
```
84-
85-
Install the **AlmaLinux 10** distro by executing the below command:
86-
87-
```shell
88-
wsl --install -d AlmaLinux-10
89-
```
90-
91-
You should see the download progress—once finished, the output should look like this:
92-
93-
```text
94-
Downloading: AlmaLinux OS 10
95-
Installing: AlmaLinux OS 10
96-
Distribution successfully installed. It can be launched via 'wsl.exe -d AlmaLinux-10'
97-
Launching AlmaLinux-10...
98-
Please create a default UNIX user account. The username does not need to match your Windows username.
99-
For more information visit: https://aka.ms/wslusers
100-
Enter new UNIX username:
101-
```
102-
103-
As per the last line, the installation process now prompts you to enter a username.
104-
This is the username you will use inside **AlmaLinux 10**, and it can be any alphanumeric string (for example `dotkernel`):
105-
106-
Next, you are prompted to change the password associated with your chosen username (you will not see what you are typing, that's a security measure in Linux regarding passwords):
107-
108-
```shell
109-
Enter new UNIX username: dotkernel.
110-
New password:
111-
```
112-
113-
Depending on the strength of your password, you might get a `BAD PASSWORD: <some-reason>` message (if you want to choose a different password, hit `Enter` and you are taken back to the previous step—else, continue with retyping your password):
114-
115-
Next, you are asked to retype your password:
116-
117-
```text
118-
Retype new password:
119-
```
120-
121-
Finally, you should see the following message:
122-
123-
```text
124-
passwd: all authentication tokens updated successfully.
125-
[<your-alma-linux-10-username>@<your-device-name> <your-windows-username>]$
126-
```
127-
128-
## Setup AlmaLinux 10
129-
130-
Install system packages:
131-
132-
```shell
133-
sudo dnf install epel-release dnf-utils https://rpms.remirepo.net/enterprise/remi-release-10.rpm -y
134-
```
135-
136-
You should see the below message, shown the first time you execute a command which requires elevated permissions (hence the `sudo` modifier at the beginning of the command).
137-
138-
```text
139-
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
140-
141-
#1) Respect the privacy of others.
142-
#2) Think before you type.
143-
#3) With great power comes great responsibility.
144-
145-
For security reasons, the password you type will not be visible.
146-
147-
[sudo] password for dotkernel:
148-
```
149-
150-
Input your **AlmaLinux 10** password and hit `Enter`.
151-
152-
Update/Upgrade system packages:
153-
154-
```shell
155-
sudo dnf upgrade -y
156-
```
157-
158-
Now, install the latest version of **Ansible Core** and run **ansible-galaxy** to install collections:
159-
160-
```shell
161-
sudo dnf install ansible-core -y
162-
```
163-
164-
```shell
165-
ansible-galaxy collection install community.general community.mysql
166-
```
167-
168-
Move inside your home directory (it is `/home/` followed by your **AlmaLinux 10** username, for example: `/home/dotkernel`):
169-
170-
```shell
171-
cd ~
172-
```
173-
174-
Clone the `alma-linux-10` branch of the `dotkernel/development` repository:
175-
176-
```shell
177-
git clone --branch alma-linux-10 --single-branch https://github.com/dotkernel/development.git
178-
```
179-
180-
Move inside the directory `development/wsl`:
181-
182-
```shell
183-
cd development/wsl/
184-
```
185-
186-
Duplicate `config.yml.dist` as `config.yml`:
187-
188-
```shell
189-
cp config.yml.dist config.yml
190-
```
191-
192-
Using your preferred text editor, open `config.yml` and fill in the empty fields.
193-
Save and close the file.
194-
195-
Install components by running the below Ansible command:
196-
197-
```shell
198-
ansible-playbook -i hosts install.yml --ask-become-pass
199-
```
200-
201-
The installation process will ask for your **AlmaLinux 10** password, then iterate over each task in the playbook and output a short summary with the results.
202-
203-
Once finished, check if everything works by opening in your browser:
204-
205-
* [http://localhost/](http://localhost/): Apache's default home page
206-
* [http://localhost/info.php](http://localhost/info.php): PHP info page
207-
* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`)
208-
209-
The installation is complete, your **AlmaLinux 10** development environment is ready to use.
210-
211-
> Restart your `Windows Terminal` to find a new option in the tab selector, called **AlmaLinux-10**; clicking it will open a new tab connected to **AlmaLinux 10**.
212-
213-
## Create virtualhosts
214-
215-
> By using the `*.localhost` pattern for any new virtualhost, you do not need to modify the `hosts` file in Windows, because these are routed by default.
216-
217-
Move inside the directory `development/wsl`:
218-
219-
```shell
220-
cd ~/development/wsl/
221-
```
222-
223-
If you don't already have a `config.yml` file, duplicate `config.yml.dist` as `config.yml`.
224-
225-
Using your preferred text editor, open `config.yml` and, under the `virtualhosts` key, enter the virtualhosts that you want to create, each on its own line.
226-
Already existing virtualhosts will be skipped, their contents will not be lost, no need to comment or remove them.
227-
Save and close the file.
228-
229-
Create the specified virtualhosts:
230-
231-
```shell
232-
ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass
233-
```
234-
235-
This process will ask for your **AlmaLinux 10** password, iterate over the list of configured `virtualhosts` and output a short summary with the results.
236-
Your virtualhost should be accessible and ready to use.
237-
238-
You will install your project under the `html` directory of your project, for example `/var/www/example.localhost/html`.
239-
240-
> The virtualhost's document root is set to the `public` directory of the above location, for example `/var/www/example.localhost/html/public`.
241-
242-
> If you want to have the DocumentRoot directly in `html` folder, you need to modify the file `/etc/httpd/sites-available/example.localhost`.
243-
244-
### Good to know
245-
246-
* To run your installed projects, you need to start **AlmaLinux 10** first.
247-
* If you work with virtualhosts, your projects are created under `/var/www/`.
248-
* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`.
249-
* If you encounter write permission issues, see [this guide](https://docs.dotkernel.org/development/v2/faq/#how-do-i-fix-common-permission-issues).
250-
* We install PHP 8.5 by default—if you need a different version, see [this guide](https://docs.dotkernel.org/development/v2/faq/#how-do-i-switch-to-a-different-version-of-php).
251-
* We install Node.js 22 by default—if you need a different version, see [this guide](https://docs.dotkernel.org/development/v2/faq/#how-do-i-switch-to-a-different-version-of-nodejs).
6+
Full, up-to-date installation instructions: <https://docs.dotkernel.org/development/v2/setup/installation/>

0 commit comments

Comments
 (0)