The Penniless Investor : Lesson 1. Setting up your investment workbench in Windows

Franklin Schram
5 min readMar 20, 2023

--

“Welcome to ‘The Penniless Investor’ — a series aimed at helping you make smarter investment choices when money is tight. Through tech-savvy tricks, free data sources, and sample investment strategies, we’ll equip you with actionable tips to make the most of your limited funds and get you started on your investing journey.”

Never take advice from an investment goblin.

Do you possess a copy of Windows 10 or 11? It is likely that you do since Microsoft gives them for free these days. Anyone working with data has most likely experienced problems dealing with Excel at some point in their workflows. There comes a time when using Excel becomes less effective, especially when dealing with large spreadsheets and multiple users, as the data can become corrupted, and the program may crash, resulting in the loss of all of your precious work and processed data. Interestingly, Windows provides a convenient solution for creating a suitable and robust environment for data analysis and development . As someone who has limited financial resources and not owning a copy of Microsoft Excel, I must confess that WSL has significantly improved my analytical work. Now, you might wonder what WSL is.

It is an acronym for Windows subsystem for Linux; WSL enables you to run Linux easily inside a Windows environement. Why would you do that?Linux is, in my view, a far superior data analysis and development environment compared to Windows. Why?

  • Whatever the programming language you want to use, you can set up a development and data analysis environment quickly by getting the right tools with the package manager. Fast, efficient, FREE.
  • It has been lovingly enhanced by other penniless guys called scientists, that have bolted on some very interesting libraries throughout the years especially when it comes to heavy number crunching.

What makes WSL so interesting vs. running an outright Linux Distro on bare metal you might ask?

  • I can boot up a Linux distro in a matter of seconds without having the need to install a dedicated Virtual Machine application like VMWare or VirtualBox.
  • I can choose to have systemd enabled or not depending on the use I want to make of the container.
  • I can can back up, export, duplicate a container with just a few commands in Window’s Powershell.
  • I DON’T NEED TO DUAL BOOT and hence keep access to the usual Windows goodies that Linux lacks.

If you’re real Linux person your head is probably hurting real bad right now but I think you should keep on reading nonetheless!

2. Meet WSL (Windows subsystem for Linux).

So let’s say I have caught your interest. How do you start? Well first you might want to “install” WSL on your version of Windows. The procedure isn’t that complicated. First you’d need to open that stuff called “THE POWERSHELL”. Open up the Powershell (or Windows terminal)

Go on! Open the TERMINAL, the place where everything BEGINS.
That should get you inside the Powershell

Once in the Powershell — type in:

wsl --install

Then reboot your computer. Once everything has rebooted, open up the Powershell again and update the WSL kernel.

wsl --update

Now the fun starts…

Do you want to see what distros you can install? Easy!

wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
Ubuntu-22.04 Ubuntu 22.04 LTS
OracleLinux_8_5 Oracle Linux 8.5
OracleLinux_7_9 Oracle Linux 7.9
SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4
openSUSE-Leap-15.4 openSUSE Leap 15.4
openSUSE-Tumbleweed openSUSE Tumbleweed

Do you want to install a distro? Easy!

wsl --install --distribution <Distribution Name>

Now lets say I’m setting up a container that will just run an app to collect FX prices, run some data integrity checks and upload the data to a MySQL server. Having set up all that stuff, why would I want to do it again ? Shall we make a back up of it in case we mess something up?

wsl --export <distribution name> <export file name>.tar
#For examplewsl --export Debian fx_bot.tar

Now I have a back up of my app and the container, should anything fails importing the container back in is super easy.

wsl --import <DistroName> <InstallLocation> <InstallTarFile>
#For examplewsl --import Arch C:\wslDistroStorage\Arch .\arch.tar

3. Setting up Daemons with Systemd

By default, Linux containers in WSL don’t run systemd on instantiation. While this can be useful if the container is just running apps, we might want to activate it in case we need to run Daemons (like a PostgreSQL server for example). To get systemd up and running you will need to add and edit a wsl.conf file to ensure systemd starts up on boot. Add these lines to the /etc/wsl.conf with sudo privileges, e.g: sudo vim /etc/wsl.conf:

[boot]
systemd=true

When this is done, close the WSL distro by closing the terminal, open up the Powershell and run wsl.exe --shutdown to restart your WSL instances. Upon the container restarting systemd should be running. You can check this with systemctl list-unit-files --type=service which should show all services’ running.

wsl --list --verbose

4. Deleting, resetting distros in WSL

We all make mistakes and sometimes nothing beats a fresh start. By default WSL lets you “reset” a distro. Think of it as a system wipe, almost like a fresh reinstall — The Microsoft guys call that “unregistering”. The distro will still be installed but it will be as good as new.

wsl --unregister DISTRO-NAME
#For examplewsl --unregister Debian

Now lets say you actually want to REMOVE the distro from your HDD. Well, this is where things get a bit ugly… Nothing is perfect right. Opening up the PowerShell and using the Windows package manager, you will get a list of all the apps installed on your system with the following:

winget list

In that case I can see two different Ubuntu distros installed. To get rid of them I can just issue the following command to winget.

winget uninstall --id "DISTRO-ID-NAME"
# For example
winget uninstall --id Canonical.Ubuntu.2004

You can also pass up the name of the app with the name parameter instead of the id one.

For a full clean up you might want to double check the install folders. In case you’re wondering where all that stuff is stored, look no further than %USERPROFILE%\AppData\Local\Packages\<distribution package name>\LocalState\.For example<distribution package name> could be TheDebianProject.DebianGNULinux_76v4gfsz19hv4 for the Debian distribution.

In the next article, we will learn how to set up a container to conduct simple FX work and write a small script to back up our containers in case something goes awry.

--

--