Windows Terminal and Friends

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.

Fortunately, Windows Subsystem for Linux (WSL) and Ubuntu 20.04 LTS were already up and running on the laptop.  So what better to use as a WT Testbed?

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.

Apache Installation

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:

  1. Disable this: # DocumentRoot /var/www/html
  2. Replace it with this: DocumentRoot /mnt/c/wslserver/www/default
  3. Add this:
    <Directory /mnt/c/wslserver/www>
       Options Indexes FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

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.

Thee were no major issues with the Apache2 installation.  I did the install, made the configuration changes noted above, entered “service apache2 start” did a “ps ax” and there it was.

MySql Installation

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.

PHP Installation

Not much to say about the “P.”  The PHP install was uneventful.  Here’s a sample of the output from the phpinfo function.

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.


Notes:

  1. The majority of software package installations were done using the Ubuntu apt command line interface.
  2. Search the web for “wsl DocumentRoot /mnt/c/” for more on this subject.
  3. The Debian Dpkg software manager.