Developing with WSL
Tips on how to develop ckan-devstaller on a Windows machine by leveraging Windows Subsystem for Linux.
When developing ckan-devstaller on Windows, using Windows Subsystem for Linux (WSL) can be advantageous to demo an Ubuntu 22.04 environment without having to set up a virtual machine.
Install the Ubuntu-22.04 distribution
You'll need to have the Ubuntu-22.04 distribution installed by running the following command:
wsl --install Ubuntu-22.04 --version 2Here's the expected set up where we create a WSL folder:
First we'll generate the images/ubuntu-22-04-snapshot.tar file:
wsl --export Ubuntu-22.04 ./images/ubuntu-22-04-snapshot.tarGenerate a VDHX file for our new instance
Next we'll generate the instances/cdr.vdhx file, so we can run the following:
wsl --import cdr ./instances ./images/ubuntu-22-04-snapshot.tarAccess your new instance as root
Now try to access your new Ubuntu 22.04 instance cdr as the root user by running:
wsl -d cdrSet yourself as the admin user on the instance and log in as the admin user
Once logged in as root, you'll want to edit the /etc/wsl.conf file and modify it so you can login as an admin user instead of root. We can use the nano editor to modify the file:
nano /etc/wsl.confModify the file by adding a [user] section with the value default=rzmk (where rzmk is your username). The file should look similar to this:
[boot]
systemd=true
[user]
default=rzmkNow leave your instance:
exitThen terminate the instance:
wsl --terminate cdrRun the instance again and you should be logged in as your admin user by default now:
wsl -d cdrInstall ckan-devstaller
Great, now you can go to the home directory and run one of the quick start scripts:
cd ~/Removing your instance
When you want to remove your instance (e.g. so that you can start a brand new instance) then run the following to unregister it:
wsl --unregister cdrThen you can follow the steps again from step 3 to generate and try out a new instance.