diff --git a/README.md b/README.md index 586fe5b..8c12052 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,13 @@ -# Install development environment +# Development environment -This collection of scripts provides multiple ways of creating and maintaining your development environment. +This is a collection of Ansible scripts allowing the creation and maintenance of your WSL2 development environment. ## Prerequisites -If you're not already using it, we recommend you to install -[Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab). +If you're not already using it, we recommend you to install [Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab). -It's a modern tool that incorporates the power of multiple already known command-line applications like -`Windows PowerShell`, `Linux shell`, and more... +It's a modern tool that incorporates the power of multiple already known command-line applications like `Windows PowerShell`, `Linux shell`, and more... -## How it works? +## Setup -Choose a tool from the below list, and we will guide you through the steps that will install and configure it for you. - -- [WSL](wsl/README.md) -- [Docker](docker/README.md) +Go to the [WSL2](wsl/README.md) setup page. diff --git a/composer.json b/composer.json index 2a0caf2..71482e6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "dotkernel/development", - "description": "Set up development environment using Ansible+WSL2/Docker.", + "description": "Set up development environment using WSL2.", "type": "metapackage", "license": "MIT", "authors": [ diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 72ff914..0000000 --- a/docker/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Install Docker development environment - -[< Back](../README.md) diff --git a/docs/book/index.md b/docs/book/index.md deleted file mode 100644 index 2eceefd..0000000 --- a/docs/book/index.md +++ /dev/null @@ -1 +0,0 @@ -# ../../README.md diff --git a/docs/book/index.md b/docs/book/index.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/docs/book/index.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/docs/book/v1/faq.md b/docs/book/v1/faq.md index 401794f..442ceda 100644 --- a/docs/book/v1/faq.md +++ b/docs/book/v1/faq.md @@ -13,10 +13,10 @@ where `{major}.{minor}` is one of the supported PHP versions: `8.4`, `8.3`, `8.2 Additionally, our setup includes predefined aliases for executing the above command. The aliases are the following: -- `php81`: switch to PHP 8.1 -- `php82`: switch to PHP 8.2 -- `php83`: switch to PHP 8.3 -- `php83`: switch to PHP 8.4 +* `php81`: switch to PHP 8.1 +* `php82`: switch to PHP 8.2 +* `php83`: switch to PHP 8.3 +* `php83`: switch to PHP 8.4 After switching to a different PHP version, test with the following command: @@ -47,9 +47,9 @@ where `{major}` is the Node.js version you want to switch to. Additionally, our setup includes predefined aliases for the above commands. The aliases are the following: -- `node22`: switch to Node.js 22 -- `node20`: switch to Node.js 20 -- `node18`: switch to Node.js 18 +* `node22`: switch to Node.js 22 +* `node20`: switch to Node.js 20 +* `node18`: switch to Node.js 18 After switching to a different Node.js version, test with the following command: @@ -67,8 +67,7 @@ If running your project, you encounter permission issues, follow the below steps > PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache" is not writable... -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache/doctrine" is not -> writable... +> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache/doctrine" is not writable... ### Solution @@ -78,8 +77,7 @@ chmod -R 777 data ### Error -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/public/uploads" is not -> writable... +> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/public/uploads" is not writable... ### Solution @@ -89,8 +87,7 @@ chmod -R 777 public/uploads ### Error -> PHP Fatal error: Uncaught ErrorException: fopen(``/log/error-log-yyyy-mm-dd.log): Failed to open -> stream: Permission denied... +> PHP Fatal error: Uncaught ErrorException: fopen(``/log/error-log-yyyy-mm-dd.log): Failed to open stream: Permission denied... ### Solution @@ -183,8 +180,8 @@ alias command_alias="command to execute" where: -- `command_alias` is the name by which you want to call your original command -- `command to execute`: the original command to be executed on alias call +* `command_alias` is the name by which you want to call your original command +* `command to execute`: the original command to be executed on alias call ### Example diff --git a/docs/book/v1/introduction.md b/docs/book/v1/introduction.md index 5cdf9b2..c681173 100644 --- a/docs/book/v1/introduction.md +++ b/docs/book/v1/introduction.md @@ -2,12 +2,12 @@ `dotkernel/development` is a tool that helps you prepare your development environment with the following components: -- **WSL2** - Windows Subsystem for Linux -- **AlmaLinux9** - free and open source Linux distribution -- **PHP** - general-purpose scripting language geared towards web development -- **Apache** - free and open-source cross-platform web server software -- **MariaDB** - community-developed, commercially supported fork of the MySQL relational database management system -- **Git** - distributed version control system -- **Composer** - application-level dependency manager for the PHP -- **Node.js** - JavaScript runtime environment -- **PhpMyAdmin** - open source administration tool for MySQL and MariaDB +* **WSL2**: Windows Subsystem for Linux +* **AlmaLinux9**: free and open source Linux distribution +* **PHP**: general-purpose scripting language geared towards web development +* **Apache**: free and open-source cross-platform web server software +* **MariaDB**: community-developed, commercially supported fork of the MySQL relational database management system +* **Git**: distributed version control system +* **Composer**: application-level dependency manager for the PHP +* **Node.js**: JavaScript runtime environment +* **PhpMyAdmin**: open source administration tool for MySQL and MariaDB diff --git a/docs/book/v1/setup/installation.md b/docs/book/v1/setup/installation.md index ca6b07b..b6f5ec3 100644 --- a/docs/book/v1/setup/installation.md +++ b/docs/book/v1/setup/installation.md @@ -1,15 +1,14 @@ # Installation -## Install AlmaLinux 9 +## Install AlmaLinux9 Open Microsoft Store, in the search box type in: `AlmaLinux` and hit `Enter`. -From the results, select **AlmaLinux 9** - this will take you to **AlmaLinux 9**'s app page. +From the results, select **AlmaLinux OS 9** this will take you to **AlmaLinux9**'s app page. -On this page, locate and click the `Install` button - this will download **AlmaLinux 9** WSL image on your system. +On this page, locate and click the `Install` button - this will download **AlmaLinux9** WSL2 image on your system. -Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open -`Windows Terminal`. +Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open `Windows Terminal`. Here you will be asked to fill in your username (for example `dotkernel`): @@ -20,8 +19,7 @@ For more information visit: https://aka.ms/wslusers Enter new UNIX username: ``` -Next, you are prompted to enter a password to use with your username (you will not see what you are typing, that's a -security measure in Linux regarding passwords): +Next, you are prompted to enter a password to use with your username (you will not see what you are typing, that's a security measure in Linux regarding passwords): ```text Enter new UNIX username: dotkernel. @@ -29,8 +27,7 @@ Changing password for user dotkernel. New password: ``` -Depending on the strength of your password, you might see one of the following messages (if you want to choose a -different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password). +Depending on the strength of your password, you might see one of the following messages (if you want to choose a different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password). ```text BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word diff --git a/docs/book/v1/setup/setup-packages.md b/docs/book/v1/setup/setup-packages.md index 286d2f3..056125f 100644 --- a/docs/book/v1/setup/setup-packages.md +++ b/docs/book/v1/setup/setup-packages.md @@ -1,6 +1,6 @@ -# Setup the packages in AlmaLinux 9 +# Setup the packages in AlmaLinux9 -Install requirements: +Install system requirements: ```shell sudo dnf install epel-release dnf-utils https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y @@ -40,20 +40,19 @@ Install requirements and initialize systemd by running the below Ansible command ansible-playbook -i hosts install.yml --ask-become-pass ``` -The installation process will ask for your password (set during the installation process) and will iterate over each -task in the playbook and will output a short summary with the results. +The installation process will ask for your password (set during the installation process) and will iterate over each task in the playbook and will output a short summary with the results. -At this step, **AlmaLinux 9** needs to be restarted - quit it by pressing `Control` + `d`. +At this step, **AlmaLinux9** needs to be restarted; quit it by pressing `Control` + `d`. Open `Windows Terminal`. -Stop **AlmaLinux 9**: +Stop **AlmaLinux9**: ```shell wsl -t AlmaLinux9 ``` -Start **AlmaLinux 9**: +Start **AlmaLinux9**: ```shell wsl -d AlmaLinux9 @@ -65,29 +64,27 @@ Move inside the directory `development/wsl`: cd ~/development/wsl/ ``` -Continue installation by running the below Ansible command: +Continue the installation by running the below Ansible command: ```shell ansible-playbook -i hosts install.yml --ask-become-pass ``` -The installation process will ask for your password (set during the installation process) and will iterate over each -task in the playbook and will output a short summary with the results. +The installation process will ask for your password (set during the installation process) and will iterate over each task in the playbook and will output a short summary with the results. Now check if everything works by opening in your browser: -- [http://localhost/](http://localhost/) - Apache's default home page -- [http://localhost/info.php](http://localhost/info.php) - PHP info page -- [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/) - PhpMyAdmin (login with `root` + the root password you - configured in `config.yml` under `mariadb` -> `root_password`) +* [http://localhost/](http://localhost/): Apache's default home page +* [http://localhost/info.php](http://localhost/info.php): PHP info page +* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`) -The installation is complete, your **AlmaLinux 9** development environment is ready to use. +The installation is complete, your **AlmaLinux9** development environment is ready to use. -## Running AlmaLinux 9 +## Running AlmaLinux9 Open `Windows Terminal`. -Start **AlmaLinux 9**: +Start **AlmaLinux9**: ```shell wsl -d AlmaLinux9 @@ -95,5 +92,5 @@ wsl -d AlmaLinux9 ### Note -> In order to run your applications using WSL2, you always need to be connected to your AlmaLinux9 distribution. +> To run your applications using WSL2, you always need to be connected to your AlmaLinux9 distribution. > For this, all you need to do is to keep open an instance of Windows Terminal that is connected to it. diff --git a/docs/book/v1/setup/system-requirements.md b/docs/book/v1/setup/system-requirements.md index 1ba3196..9c41426 100644 --- a/docs/book/v1/setup/system-requirements.md +++ b/docs/book/v1/setup/system-requirements.md @@ -1,7 +1,6 @@ # System Requirements -First, you need to check if your system is ready for using **WSL2**. Open `Windows Terminal` and execute the following -command: +First, you need to check if your system is ready for using **WSL2**. Open `Windows Terminal` and execute the following command: ```shell wsl -v @@ -19,28 +18,23 @@ DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.22631.3737 ``` -If the output starts with `WSL version: 2.x`, you are ready to use **WSL2** and can continue with -[the installation](installation.md). +If the output starts with `WSL version: 2.x`, you are ready to use **WSL2** and can continue with [the installation](installation.md). -Else, you need to install **WSL2** and it's components as shown below. +Else, you need to install **WSL2** and its components as shown below. -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**. +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**. -Once you know that your system can run **WSL2**, open the `Run` prompt by pressing `Win`+`r` and type in the dialog -`OptionalFeatures`, then press `Enter`. +Once you know that your system can run **WSL2**, open the `Run` prompt by pressing `Win`+`r` and type in the dialog `OptionalFeatures`, then press `Enter`. This will open a window where you can turn Windows features on/off. Make sure the next features are activated (checked): -- `Hyper-V` (including its sub-features) -- `Virtual Machine Platform` -- `Windows Subsystem for Linux` +* `Hyper-V` (including its sub-features) +* `Virtual Machine Platform` +* `Windows Subsystem for Linux` -> If any of the above features is 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. +> 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. Click `Ok` and restart your computer. @@ -58,5 +52,4 @@ To test, run again the following command: wsl -v ``` -This time the output should display `WSL version: 2.x`, which means that your system is ready for using **WSL2** and you -can continue with the [installation](installation.md). +This time the output should display `WSL version: 2.x`, which means that your system is ready for using **WSL2** and you can continue with the [installation](installation.md). diff --git a/docs/book/v1/virtualhosts/create-virtualhost.md b/docs/book/v1/virtualhosts/create-virtualhost.md index 723b874..5fd2bdc 100644 --- a/docs/book/v1/virtualhosts/create-virtualhost.md +++ b/docs/book/v1/virtualhosts/create-virtualhost.md @@ -6,8 +6,7 @@ Move inside the directory `development/wsl`: cd ~/development/wsl/ ``` -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. +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. Already existing virtualhosts will be skipped, their contents will not be lost, no need to comment or remove them. @@ -19,27 +18,21 @@ Create the specified virtualhosts: ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass ``` -This process will ask for your password (set during the installation process) and then iterate over the list of -configured `virtualhosts` and will output a short summary with the results. +This process will ask for your password (set during the installation process) and then iterate over the list of configured `virtualhosts` and will output a short summary with the results. Your virtualhost should be accessible and ready to use. -You will install your project under the `html` directory of your project, for example: -`/var/www/example.localhost/html`. +You will install your project under the `html` directory of your project, for example `/var/www/example.localhost/html`. -> The virtualhost's document root is set to the `public` directory of the above location, for example -> `/var/www/example.localhost/html/public`. -> -> If you want to have the DocumentRoot directly in `html` folder, you need to modify the file -> `/etc/httpd/sites-available/example.localhost`. +> The virtualhost's document root is set to the `public` directory of the above location, for example `/var/www/example.localhost/html/public`. + +> If you want to have the DocumentRoot directly in `html` folder, you need to modify the file `/etc/httpd/sites-available/example.localhost`. ## Good to know -- In order to run your installed projects, you need to start AlmaLinux 9 first. -- If you work with virtualhosts, your projects are created under `/var/www/`. -- You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`. -- If you encounter write permission issues, see [this guide](../faq.md#how-do-i-fix-common-permission-issues). -- This tool installs PHP 8.3 by default. If you need a different version, see -[this guide](../faq.md#how-do-i-switch-to-a-different-version-of-php). -- This tool installs Node.js 22 by default. If you need a different version, see -[this guide](../faq.md#how-do-i-switch-to-a-different-version-of-nodejs). +* To run your installed projects, you need to start AlmaLinux9 first. +* If you work with virtualhosts, your projects are created under `/var/www/`. +* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`. +* If you encounter write permission issues, see [this guide](../faq.md#how-do-i-fix-common-permission-issues). +* This tool installs PHP 8.3 by default. If you need a different version, see [this guide](../faq.md#how-do-i-switch-to-a-different-version-of-php). +* This tool installs Node.js 22 by default. If you need a different version, see [this guide](../faq.md#how-do-i-switch-to-a-different-version-of-nodejs). diff --git a/wsl/README.md b/wsl/README.md index 078158e..3964fc9 100644 --- a/wsl/README.md +++ b/wsl/README.md @@ -12,9 +12,9 @@ This will open a window where you can turn Windows features on/off. Make sure the next features are activated (checked): -- `Hyper-V` (including its sub-features) -- `Virtual Machine Platform` -- `Windows Subsystem for Linux` +* `Hyper-V` (including its sub-features) +* `Virtual Machine Platform` +* `Windows Subsystem for Linux` > 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. @@ -30,5 +30,4 @@ wsl --set-default-version 2 ## Choose the Operating System you want to use for development: -- [Ubuntu 20](os/ubuntu20/README.md) -- [AlmaLinux 9](os/almalinux9/README.md) +* [AlmaLinux9](os/almalinux9/README.md) diff --git a/wsl/create-virtualhost.yml b/wsl/create-virtualhost.yml index adaff4e..98196d3 100644 --- a/wsl/create-virtualhost.yml +++ b/wsl/create-virtualhost.yml @@ -19,7 +19,5 @@ assert: that: os in os_list msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported" -- import_playbook: "{{ playbook_dir }}/os/ubuntu20/create-virtualhost.yml" - when: os == "ubuntu20" - import_playbook: "{{ playbook_dir }}/os/almalinux9/create-virtualhost.yml" when: os == "almalinux9" diff --git a/wsl/install.yml b/wsl/install.yml index 8160348..daa0e43 100644 --- a/wsl/install.yml +++ b/wsl/install.yml @@ -19,7 +19,5 @@ assert: that: os in os_list msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported" -- import_playbook: "{{ playbook_dir }}/os/ubuntu20/install.yml" - when: os == "ubuntu20" - import_playbook: "{{ playbook_dir }}/os/almalinux9/install.yml" when: os == "almalinux9" diff --git a/wsl/os/almalinux9/FAQ.md b/wsl/os/almalinux9/FAQ.md index 08e3106..6314497 100644 --- a/wsl/os/almalinux9/FAQ.md +++ b/wsl/os/almalinux9/FAQ.md @@ -13,10 +13,10 @@ where `{major}.{minor}` is one of the supported PHP versions: `8.4`, `8.3`, `8.2 Additionally, our setup includes predefined aliases for executing the above command. The aliases are the following: -- `php81`: switch to PHP 8.1 -- `php82`: switch to PHP 8.2 -- `php83`: switch to PHP 8.3 -- `php84`: switch to PHP 8.4 +* `php81`: switch to PHP 8.1 +* `php82`: switch to PHP 8.2 +* `php83`: switch to PHP 8.3 +* `php84`: switch to PHP 8.4 After switching to a different PHP version, test with the following command: @@ -47,9 +47,9 @@ where `{major}` is the Node.js version you want to switch to. Additionally, our setup includes predefined aliases for the above commands. The aliases are the following: -- `node22`: switch to Node.js 22 -- `node20`: switch to Node.js 20 -- `node18`: switch to Node.js 18 +* `node22`: switch to Node.js 22 +* `node20`: switch to Node.js 20 +* `node18`: switch to Node.js 18 After switching to a different Node.js version, test with the following command: @@ -67,8 +67,7 @@ If running your project, you encounter permission issues, follow the below steps > PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache" is not writable... -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache/doctrine" is not -> writable... +> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache/doctrine" is not writable... ### Solution @@ -78,8 +77,7 @@ chmod -R 777 data ### Error -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/public/uploads" is not -> writable... +> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/public/uploads" is not writable... ### Solution @@ -89,8 +87,7 @@ chmod -R 777 public/uploads ### Error -> PHP Fatal error: Uncaught ErrorException: fopen(``/log/error-log-yyyy-mm-dd.log): Failed to open -> stream: Permission denied... +> PHP Fatal error: Uncaught ErrorException: fopen(``/log/error-log-yyyy-mm-dd.log): Failed to open stream: Permission denied... ### Solution @@ -183,8 +180,8 @@ alias command_alias="command to execute" where: -- `command_alias` is the name by which you want to call your original command -- `command to execute`: the original command to be executed on alias call +* `command_alias` is the name by which you want to call your original command +* `command to execute`: the original command to be executed on alias call ### Example: diff --git a/wsl/os/almalinux9/README.md b/wsl/os/almalinux9/README.md index 63517ef..6474e4b 100644 --- a/wsl/os/almalinux9/README.md +++ b/wsl/os/almalinux9/README.md @@ -1,12 +1,12 @@ -# Install WSL development environment on AlmaLinux 9 +# Install WSL2 development environment on AlmaLinux9 [< Dotkernel: Install development environment](../../README.md) -## Download AlmaLinux 9 image +## Download AlmaLinux9 image -Download **AlmaLinux 9** image by following one of the below methods. +Download **AlmaLinux9** image by following one of the below methods. -### Method 1: Download AlmaLinux 9 WSL image using Windows Terminal +### Method 1: Download AlmaLinux9 WSL2 image using Windows Terminal Open `Windows Terminal` and execute the following command: @@ -23,19 +23,19 @@ AlmaLinux 9 has been installed. Launching AlmaLinux 9... ``` -Also, you should find a new tab in `Windows Terminal` that is already connected to **AlmaLinux 9**. +Also, you should find a new tab in `Windows Terminal` that is already connected to **AlmaLinux9**. -### Method 2: Download AlmaLinux 9 WSL image from Microsoft Store +### Method 2: Download AlmaLinux9 WSL2 image from Microsoft Store Open Microsoft Store, type `AlmaLinux` in the search box and hit `Enter`. -From the results, select `AlmaLinux 9` - this will take you to AlmaLinux 9's app page. +From the results, select `AlmaLinux OS 9` - this will take you to AlmaLinux9's app page. -On this page, locate and click the `Install` button - this will download AlmaLinux 9 WSL image on your machine. +On this page, locate and click the `Install` button - this will download AlmaLinux9 WSL2 image on your machine. Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open `Windows Terminal`. -## Install AlmaLinux 9 +## Install AlmaLinux9 You will be asked to fill in your username (for example `dotkernel`): @@ -54,7 +54,7 @@ Changing password for user dotkernel. New password: ``` -Depending on the strength of your password, you might see one of the following messages (if you want to choose a different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password) +Depending on the strength of your password, you might see one of the following messages (if you want to choose a different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password): ```text BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word @@ -75,7 +75,7 @@ Installation successful! [dotkernel@hostname:~]$ ``` -## Setup AlmaLinux 9 +## Setup AlmaLinux9 Install requirements: @@ -119,17 +119,17 @@ ansible-playbook -i hosts install.yml --ask-become-pass The installation process will iterate over each task in the playbook and will output a short summary with the results. -AlmaLinux 9 needs to be restarted, so quit it by pressing `Control` + `d`. +AlmaLinux9 needs to be restarted, so quit it by pressing `Control` + `d`. Open Windows Terminal. -Stop AlmaLinux 9: +Stop AlmaLinux9: ```shell wsl -t AlmaLinux9 ``` -Start AlmaLinux 9: +Start AlmaLinux9: ```shell wsl -d AlmaLinux9 @@ -151,9 +151,9 @@ The installation process will iterate over each task in the playbook and will ou Now check if everything works by opening in your browser: -- [http://localhost/](http://localhost/): Apache's default home page -- [http://localhost/info.php](http://localhost/info.php): PHP info page -- [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`) +* [http://localhost/](http://localhost/): Apache's default home page +* [http://localhost/info.php](http://localhost/info.php): PHP info page +* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`) The installation is complete, your development environment is ready to use. @@ -165,8 +165,7 @@ Move inside the directory `development/wsl`: cd ~/development/wsl/ ``` -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. +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. Already existing ones will be skipped, no need to comment or remove them. @@ -192,9 +191,9 @@ You will install your project under the `html` directory of your project, for ex ### Good to know -- To run your installed projects, you need to start AlmaLinux 9 first. -- If you work with virtualhosts, your projects are created under `/var/www/`. -- You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`. -- If you encounter write permission issues, see [this guide](FAQ.md#how-do-i-fix-common-permission-issues). -- We install PHP 8.3 by default. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-to-a-different-version-of-php). -- We install Node.js 22 by default. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-to-a-different-version-of-nodejs). +* To run your installed projects, you need to start AlmaLinux9 first. +* If you work with virtualhosts, your projects are created under `/var/www/`. +* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`. +* If you encounter write permission issues, see [this guide](FAQ.md#how-do-i-fix-common-permission-issues). +* We install PHP 8.3 by default. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-to-a-different-version-of-php). +* We install Node.js 22 by default. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-to-a-different-version-of-nodejs). diff --git a/wsl/os/almalinux9/create-virtualhost.yml b/wsl/os/almalinux9/create-virtualhost.yml index 17e02ed..e454e10 100644 --- a/wsl/os/almalinux9/create-virtualhost.yml +++ b/wsl/os/almalinux9/create-virtualhost.yml @@ -1,5 +1,5 @@ --- -- name: Create new virtualhost under AlmaLinux 9 +- name: Create new virtualhost under AlmaLinux9 hosts: localhost connection: local become: true diff --git a/wsl/os/almalinux9/install.yml b/wsl/os/almalinux9/install.yml index d031e21..861296c 100644 --- a/wsl/os/almalinux9/install.yml +++ b/wsl/os/almalinux9/install.yml @@ -1,5 +1,5 @@ --- -- name: Setup AlmaLinux 9 development environment +- name: Setup AlmaLinux9 development environment hosts: localhost connection: local become: true diff --git a/wsl/os/requirements.yml b/wsl/os/requirements.yml deleted file mode 100644 index a173f75..0000000 --- a/wsl/os/requirements.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: community.general - src: https://github.com/ansible-collections/community.general -- name: community.mysql - src: https://github.com/ansible-collections/community.mysql diff --git a/wsl/os/ubuntu20/FAQ.md b/wsl/os/ubuntu20/FAQ.md deleted file mode 100644 index 6db4dab..0000000 --- a/wsl/os/ubuntu20/FAQ.md +++ /dev/null @@ -1,98 +0,0 @@ -# Frequently Asked Questions - -## How do I switch between PHP versions? - -In this example we will switch from PHP version 7.4 to 8.1. - -Follow the same pattern if you need to switch between other versions than the ones presented in this example. - -Step 1: Disable PHP7.4: - -```shell -sudo a2dismod php7.4 -``` - -Step 2: Enable PHP8.1: - -```shell -sudo a2enmod php8.1 -``` - -Step 3: Make sure `php` points to PHP8.1: - -```shell -sudo update-alternatives --set php /usr/bin/php8.1 -``` - -Step 4: Restart HTTP server: - -```shell -sudo service apache2 restart -``` - -## How do I switch to a different version of Node.js? - -### Switch to Node.js 22.x - -```shell -sudo apt remove nodejs -y -curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - -sudo apt install nodejs -y -``` - -### Switch to Node.js 20.x - -```shell -sudo apt remove nodejs -y -curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - -sudo apt install nodejs -y -``` - -### Switch to Node.js 18.x - -```shell -sudo apt remove nodejs -y -curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - -sudo apt install nodejs -y -``` - -## How do I fix common permission issues? - -If running your project you encounter permission issues, follow the below steps. - -### Error - -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data" is not writable... - -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache" is not writable... - -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/data/cache/doctrine" is not -> writable... - -### Solution - -```shell -chmod -R 777 data -``` - -### Error - -> PHP Fatal error: Uncaught InvalidArgumentException: The directory "``/public/uploads" is not -> writable... - -### Solution - -```shell -chmod -R 777 public/uploads -``` - -### Error - -> PHP Fatal error: Uncaught ErrorException: fopen(``/log/error-log-yyyy-mm-dd.log): Failed to open -> stream: Permission denied... - -### Solution - -```shell -chmod -R 777 log -``` diff --git a/wsl/os/ubuntu20/README.md b/wsl/os/ubuntu20/README.md deleted file mode 100644 index cdc9ad9..0000000 --- a/wsl/os/ubuntu20/README.md +++ /dev/null @@ -1,168 +0,0 @@ -# Install WSL development environment on Ubuntu 20 - -[< Dotkernel: Install development environment](../../README.md) - -## Download Ubuntu 20 WSL image - -Download `Ubuntu 20` image by following one of the below methods. - -### Method 1: Download Ubuntu 20 WSL image using Windows Terminal - -Open `Windows Terminal` and execute the following command: - -```shell -wsl --install -d Ubuntu-20.04 -``` - -You should see the download progress, and once finished, the output should look like this: - -```text -Downloading: Ubuntu 20.04 LTS -Installing: Ubuntu 20.04 LTS -Ubuntu 20.04 LTS has been installed. -Launching Ubuntu 20.04 LTS... -``` - -Also, you should find a new tab in `Windows Terminal` that is already connected to Ubuntu 20. - -### Method 2: Download Ubuntu 20 WSL image from Microsoft Store - -Open Microsoft Store, type `Ubuntu` in the search box and hit `Enter`. - -From the results, select `Ubuntu 20.04.4 LTS` - this will take you to Ubuntu 20's app page. - -On this page, locate and click the `Install` button - this will download Ubuntu 20 WSL image on your machine. - -Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open `Windows Terminal`. - -## Install Ubuntu 20 - -You will be asked to fill in your username (for example `dotkernel`): - -```text -Installing, this may take a few minutes... -Please create a default UNIX user account. The username does not need to match your Windows username. -For more information visit: https://aka.ms/wslusers -Enter new UNIX username: -``` - -Next, you are prompted to enter a password to use with your username (you will not see what you are typing, that's a security measure in Linux regarding passwords): - -```text -Enter new UNIX username: dotkernel. -Changing password for user dotkernel. -New password: -``` - -Next, you are asked to retype your password: - -```text -Retype new password: -``` - -Finally, you should see the following message: - -```text -passwd: password updated successfully -Installation successful! -... -dotkernel@hostname:~$ -``` - -## Install services on Ubuntu 20 - -Update/Upgrade system packages: - -```shell -sudo apt-get update && sudo apt-get upgrade -y -``` - -Now, install the latest version of Ansible: - -```shell -sudo apt-get install ansible -y -``` - -Clone dotkernel/development into your home directory: - -```shell -git clone https://github.com/dotkernel/development.git -``` - -Move inside the directory `development/wsl`: - -```shell -cd ~/development/wsl/ -``` - -Using your preferred text editor, open `config.yml` where you must fill in the empty fields. - -Save and close the file. - -Install and configure all necessary services by running the below Ansible command: - -```shell -ansible-playbook -i hosts install.yml --ask-become-pass -``` - -The installation process will iterate over each task in the playbook and will output a short summary with the results. - -At this point, `Ubuntu 20` needs to be restarted, so quit it by pressing `Control` + `d`. - -Open `Windows Terminal`. - -Stop Ubuntu 20: - -```shell -wsl -t Ubuntu-20.04 -``` - -Start Ubuntu 20: - -```shell -wsl -d Ubuntu-20.04 -``` - -Now check if everything works by opening in your browser: - -- [http://localhost/](http://localhost/): Apache's default home page -- [http://localhost/info.php](http://localhost/info.php): PHP info page -- [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`) - -The installation is complete, your development environment is ready to use. - -## Create virtual hosts - -Move inside the directory `development/wsl`: - -```shell -cd ~/development/wsl/ -``` - -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. - -Already existing ones will be skipped, no need to comment or remove them. - -Save and close the file. - -Create the specified virtualhosts: - -```shell -ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass -``` - -This will iterate over the list of configured `virtualhosts` and will output a short summary with the results. - -Your virtualhost should be accessible and ready to use. - -You will install your projects under the `/home/your-username/projects/` directory. -The virtualhost's document root is set to the `public` directory of the above location, for example `/home/your-username/projects/example.local/public`. - -**Note**: - -- To run your installed projects, you need to start Ubuntu 20 first. -- If you work with virtualhosts, your projects are created under `/home/your-username/projects/`. -- You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`. -- If you encounter write permission issues, see [this guide](FAQ.md#how-do-i-fix-common-permission-issues). -- The default version of PHP is set to 8.3. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-between-php-versions). -- We install Node.js 22 by default. If you need a different version, see [this guide](FAQ.md#how-do-i-switch-to-a-different-version-of-nodejs). diff --git a/wsl/os/ubuntu20/create-virtualhost.yml b/wsl/os/ubuntu20/create-virtualhost.yml deleted file mode 100644 index 1df0075..0000000 --- a/wsl/os/ubuntu20/create-virtualhost.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Create new virtualhost under Ubuntu 20 - hosts: localhost - connection: local - become: true - gather_facts: true - vars_files: - - ../../config.yml - - ./roles/user/vars/main.yml - roles: - - _ - - virtualhost diff --git a/wsl/os/ubuntu20/install.yml b/wsl/os/ubuntu20/install.yml deleted file mode 100644 index 924fea7..0000000 --- a/wsl/os/ubuntu20/install.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Setup Ubuntu 20 development environment - hosts: localhost - connection: local - become: true - gather_facts: true - vars_files: - - ../../config.yml - roles: - - _ - - system - - apache - - mariadb - - php - - phpmyadmin - - composer - - nodejs - - git - - user diff --git a/wsl/os/ubuntu20/roles/_/handlers/main.yml b/wsl/os/ubuntu20/roles/_/handlers/main.yml deleted file mode 100644 index 85457be..0000000 --- a/wsl/os/ubuntu20/roles/_/handlers/main.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Start Apache - service: - name: apache2 - state: started -- name: Stop Apache - service: - name: apache2 - state: stopped -- name: Restart Apache - service: - name: apache2 - state: restarted -- name: Reload Apache - service: - name: apache2 - state: reloaded -- name: Start MariaDB - service: - name: mysql - state: started -- name: Stop MariaDB - service: - name: mysql - state: stopped -- name: Restart MariaDB - service: - name: mysql - state: restarted -- name: Enable MariaDB - service: - name: mysql - enabled: yes diff --git a/wsl/os/ubuntu20/roles/apache/tasks/main.yml b/wsl/os/ubuntu20/roles/apache/tasks/main.yml deleted file mode 100644 index 4c4b41a..0000000 --- a/wsl/os/ubuntu20/roles/apache/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Install Apache - apt: - name: apache2 - state: latest -- name: Enable rewrite module - command: a2enmod rewrite -- name: Allow port 80 through firewall - ufw: - rule: allow - port: "{{ apache_port }}" - proto: tcp diff --git a/wsl/os/ubuntu20/roles/apache/vars/main.yml b/wsl/os/ubuntu20/roles/apache/vars/main.yml deleted file mode 100644 index 0abfe42..0000000 --- a/wsl/os/ubuntu20/roles/apache/vars/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -apache_port: "80" -apache_config_file: /etc/apache2/apache2.conf -apache_home_dir: /var/www/html diff --git a/wsl/os/ubuntu20/roles/composer/tasks/main.yml b/wsl/os/ubuntu20/roles/composer/tasks/main.yml deleted file mode 100644 index 7a61477..0000000 --- a/wsl/os/ubuntu20/roles/composer/tasks/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Check if Composer is already installed - stat: - path: "{{ composer_path }}" - register: composer_executable -- name: Download Composer - get_url: - url: "{{ composer_download_url }}" - dest: "{{ composer_download_dest }}" - when: composer_executable.stat.isreg is not defined or not composer_executable.stat.isreg -- name: Install Composer - command: php "{{ composer_download_dest }}" --install-dir="{{ bin_directory }}" --filename="{{ composer_filename }}" - when: composer_executable.stat.isreg is not defined or not composer_executable.stat.isreg diff --git a/wsl/os/ubuntu20/roles/composer/vars/main.yml b/wsl/os/ubuntu20/roles/composer/vars/main.yml deleted file mode 100644 index a16f26c..0000000 --- a/wsl/os/ubuntu20/roles/composer/vars/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -bin_directory: /usr/local/bin -composer_download_url: https://getcomposer.org/installer -composer_download_dest: /tmp/composer-setup.php -composer_filename: composer -composer_path: "{{ bin_directory }}/{{ composer_filename }}" diff --git a/wsl/os/ubuntu20/roles/git/tasks/main.yml b/wsl/os/ubuntu20/roles/git/tasks/main.yml deleted file mode 100644 index 14f1146..0000000 --- a/wsl/os/ubuntu20/roles/git/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Install Git - apt: - name: git - state: latest -- name: Apply global configurations - git_config: - name: "{{ item.key }}" - value: "{{ item.value }}" - scope: global - with_dict: "{{ git_config }}" -- name: Apply global user configurations - git_config: - name: "{{ item.key }}" - value: "{{ item.value }}" - scope: global - with_dict: "{{ config.git.config }}" diff --git a/wsl/os/ubuntu20/roles/git/vars/main.yml b/wsl/os/ubuntu20/roles/git/vars/main.yml deleted file mode 100644 index a8891df..0000000 --- a/wsl/os/ubuntu20/roles/git/vars/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -git_config: -- "core.autocrlf": "false" -- "core.eol": "lf" diff --git a/wsl/os/ubuntu20/roles/mariadb/tasks/main.yml b/wsl/os/ubuntu20/roles/mariadb/tasks/main.yml deleted file mode 100644 index df6ebf4..0000000 --- a/wsl/os/ubuntu20/roles/mariadb/tasks/main.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: Install MariaDB - apt: - name: - - mysql-server - - mysql-client - - python3-pymysql - state: latest -- name: Assign home directory - command: usermod -d /var/lib/mysql/ mysql -- name: Start and enable MariaDB - service: - name: mysql - state: restarted - enabled: true -- name: Set MariaDB root password - mysql_user: - name: root - password: "{{ config.mariadb.root_password }}" - login_unix_socket: "{{ login_unix_socket }}" - state: present - no_log: true -- name: Create my.cnf config file - template: - src: my.cnf.j2 - dest: "{{ mariadb_mycnf_dest }}" - notify: Restart MariaDB diff --git a/wsl/os/ubuntu20/roles/mariadb/templates/my.cnf.j2 b/wsl/os/ubuntu20/roles/mariadb/templates/my.cnf.j2 deleted file mode 100644 index bc5b24b..0000000 --- a/wsl/os/ubuntu20/roles/mariadb/templates/my.cnf.j2 +++ /dev/null @@ -1,2 +0,0 @@ -[mysql] -socket="{{ login_unix_socket }}" diff --git a/wsl/os/ubuntu20/roles/mariadb/vars/main.yml b/wsl/os/ubuntu20/roles/mariadb/vars/main.yml deleted file mode 100644 index d1e849c..0000000 --- a/wsl/os/ubuntu20/roles/mariadb/vars/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -login_unix_socket: "/run/mysqld/mysqld.sock" -mariadb_mycnf_dest: /etc/my.cnf diff --git a/wsl/os/ubuntu20/roles/nodejs/tasks/main.yml b/wsl/os/ubuntu20/roles/nodejs/tasks/main.yml deleted file mode 100644 index 52106dd..0000000 --- a/wsl/os/ubuntu20/roles/nodejs/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Add Node.js 22.x repo - shell: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - - args: - warn: no -- name: Install Node.js 22.x - apt: - name: nodejs - state: latest diff --git a/wsl/os/ubuntu20/roles/php/tasks/main.yml b/wsl/os/ubuntu20/roles/php/tasks/main.yml deleted file mode 100644 index 308ea58..0000000 --- a/wsl/os/ubuntu20/roles/php/tasks/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Install PHP versions - include_role: - name: php - tasks_from: "php{{ php_version }}" - loop: "{{ php_versions }}" - loop_control: - loop_var: php_version -- name: Create PHP info file - template: - src: "{{ php_info_filename }}.j2" - dest: "{{ apache_home_dir }}/{{ php_info_filename }}" - notify: Restart Apache diff --git a/wsl/os/ubuntu20/roles/php/tasks/php81.yml b/wsl/os/ubuntu20/roles/php/tasks/php81.yml deleted file mode 100644 index 95c4dad..0000000 --- a/wsl/os/ubuntu20/roles/php/tasks/php81.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Add ppa:ondrej/php repository - apt_repository: - repo: ppa:ondrej/php - update_cache: true -- name: Install PHP 8.1 - apt: - name: - - php8.1 - - php8.1-common - - php8.1-bz2 - - php8.1-cli - - php8.1-curl - - php8.1-intl - - php8.1-mbstring - - php8.1-mysql - - php8.1-xml - - php8.1-zip - - libapache2-mod-php8.1 - state: present diff --git a/wsl/os/ubuntu20/roles/php/tasks/php82.yml b/wsl/os/ubuntu20/roles/php/tasks/php82.yml deleted file mode 100644 index b989ef5..0000000 --- a/wsl/os/ubuntu20/roles/php/tasks/php82.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Add ppa:ondrej/php repository - apt_repository: - repo: ppa:ondrej/php - update_cache: true -- name: Install PHP 8.2 - apt: - name: - - php8.2 - - php8.2-common - - php8.2-bz2 - - php8.2-cli - - php8.2-curl - - php8.2-intl - - php8.2-mbstring - - php8.2-mysql - - php8.2-xml - - php8.2-zip - - libapache2-mod-php8.2 - state: present diff --git a/wsl/os/ubuntu20/roles/php/tasks/php83.yml b/wsl/os/ubuntu20/roles/php/tasks/php83.yml deleted file mode 100644 index 632f596..0000000 --- a/wsl/os/ubuntu20/roles/php/tasks/php83.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Add ppa:ondrej/php repository - apt_repository: - repo: ppa:ondrej/php - update_cache: true -- name: Install PHP 8.3 - apt: - name: - - php8.3 - - php8.3-common - - php8.3-bz2 - - php8.3-cli - - php8.3-curl - - php8.3-intl - - php8.3-mbstring - - php8.3-mysql - - php8.3-xml - - php8.3-zip - - libapache2-mod-php8.3 - state: present diff --git a/wsl/os/ubuntu20/roles/php/tasks/php84.yml b/wsl/os/ubuntu20/roles/php/tasks/php84.yml deleted file mode 100644 index f96c056..0000000 --- a/wsl/os/ubuntu20/roles/php/tasks/php84.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Add ppa:ondrej/php repository - apt_repository: - repo: ppa:ondrej/php - update_cache: true -- name: Install PHP 8.4 - apt: - name: - - php8.4 - - php8.4-common - - php8.4-bz2 - - php8.4-cli - - php8.4-curl - - php8.4-intl - - php8.4-mbstring - - php8.4-mysql - - php8.4-xml - - php8.4-zip - - libapache2-mod-php8.4 - state: present diff --git a/wsl/os/ubuntu20/roles/php/templates/info.php.j2 b/wsl/os/ubuntu20/roles/php/templates/info.php.j2 deleted file mode 100644 index 83f1549..0000000 --- a/wsl/os/ubuntu20/roles/php/templates/info.php.j2 +++ /dev/null @@ -1,3 +0,0 @@ - - # The ServerName directive sets the request scheme, hostname and port that - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - - ServerName {{ virtualhost }} - ServerAlias www.{{ virtualhost }} - - ServerAdmin webmaster@localhost - DocumentRoot {{ user_projects_dir }}/{{ virtualhost }}/public - - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf -