I recently installed the new Windows Terminal (WT) application on the my laptop. In addition to the everyday stuff one does on a laptop, it is the primary source for the “care and feeding” of our web sites.
Once I convinced myself that WT did work as advertised, I began thinking about what I could actually do with the WT/WSL/Ubuntu stuff. Took me a while but, as usual, the obvious finally struck me! I was currently using XAMPP as the test and development web server on my local network. I could build a LAMP server to replace the existing XAMPP server. The following summarizes the “Good, Bad and Ugly” of this task.
The “L” was already up and running so the next order of business was to install the “A.” A quick “sudo apt1 install apache2″ installed the Apache2 HTTP Server. The default configuration was used with one notable addition. In the /etc/apache2/sites-enabled/000-default.conf file, do the following2:
- Disable this: # DocumentRoot /var/www/html
- Replace it with this: DocumentRoot /mnt/c/wslserver/www/default
- Add this:
Options Indexes FollowSymLinks
Require all granted
The server’s data files will then reside on the Windows C:\wslserver directory, thus making them visible to both the WSL and Windows 10 environments. There is no special meaning to the “wslserver” directory name. Whatever name floats your particular boat will do.
The next chore was the “M” install. It wasn’t quite as simple as the Apache2 install but after a few self-inflicted wounds, the MySql Server was up and running. The big issue here was getting the dependencies to load. I finally resorted to getting down in the dirt and using the Debian dpkg3 manager, which to my amazement installed all the dependent software packages with no complaints. The “service mysql start” did indeed start the MySql Server, so on to the next step.
The Final Test – Part 1
We needed an application that would test the combination of Apache2, MySql and PHP. PhpMyAdminsatisfied this requirement and also gave us a robust tool for database administration. Once it was installed, we entered “http://localhost/phpadmin” in in browser address field and got the “Hmm. We’re having trouble finding that site.” response. After recovering from the initial shock, this turned out to be a firewall issue. For the Win 10 Pivate Network Firewall we needed to block incoming packets to XAMPP and formulate new rules that allowed incoming packets to WSL for ports 80 and 443. Once that was done, everything worked as advertised.
he Final Test – Part 2
The second part of final testing was to move an existing web site from XAMPP to the new LAMP server and ensure that the site was still functional. Using the Win 10 File explorer we did a copy/paste of the C:\xampp\htdocs\tools directory content to the c:\wslserver\www\default\tools directory. We then accessed the site from local host and another PC on the local network. All went as expected.
The Final Touch
At present, the WSL/Ubuntu 20.04 administration is via command line only – no fancy point and click graphical stuff. But not to worry, we do have a solution..Webmin. We installed it and now have a web-based point & click interface for administering this stuff.