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.

Adventures With WSL

Finally got around to installing Windows Subsystem for Linux (WSL) on my miniature desktop PC.

There are two Win 10 applications that must be “tweaked” for WSL to work as advertised: Command Prompt and PowerShell.  If your system has both Command Prompt and PowerShell installed, you must do the following to both.

  • Prior to installing WSL, open the Command/PowerShell menu by right clicking on the small icon in the upper left of the window.
  • Select the Properties entry.
  • In the Properties window, Select the Option Tab and uncheck the “Use legacy console” box.
  • Close this Command/PowerShell instance.
  • Open a new Command/PowerShell instance.
  • Open the Command/PowerShell menu.
  • Select the Properties entry.
  • In the Properties window, Select the Terminal Tab and uncheck both the “Use Separate Foreground” box and the “Use Separate Background” box.
  • Close this Command/PowerShell instance.

Once this is done, go to the Windows Store and download and install the WSL application.  There are a number of Linux distributions you can choose from.  Ubuntu is the default.

What this gives you is a standard Linux Terminal capability: a Linux kernel and a Bash Shell,i.e., a Linux command-line capability.  Sorry but no easy-peasy point and click stuff…maybe someday!!