mirror of
https://github.com/dathere/ckan-devstaller.git
synced 2025-11-09 13:39:49 +00:00
131 lines
2.6 KiB
Text
131 lines
2.6 KiB
Text
---
|
|
title: Developing with WSL
|
|
description: 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.
|
|
|
|
import { Step, Steps } from 'fumadocs-ui/components/steps';
|
|
import { File, Folder, Files } from 'fumadocs-ui/components/files';
|
|
|
|
<Steps>
|
|
<Step>
|
|
|
|
### Install the Ubuntu-22.04 distribution
|
|
|
|
You'll need to have the Ubuntu-22.04 distribution installed by running the following command:
|
|
|
|
```bash
|
|
wsl --install Ubuntu-22.04 --version 2
|
|
```
|
|
|
|
</Step>
|
|
|
|
<Step>
|
|
|
|
### Export a base image
|
|
|
|
</Step>
|
|
|
|
Here's the expected set up where we create a WSL folder:
|
|
|
|
```files
|
|
/c/Users/rzmk/WSL
|
|
├── images
|
|
| ├── ubuntu-22-04-snapshot.tar
|
|
├── instances
|
|
| ├── cdr.vdhx
|
|
```
|
|
|
|
First we'll generate the `images/ubuntu-22-04-snapshot.tar` file:
|
|
|
|
```bash
|
|
wsl --export Ubuntu-22.04 ./images/ubuntu-22-04-snapshot.tar
|
|
```
|
|
|
|
<Step>
|
|
|
|
### Generate a VDHX file for our new instance
|
|
|
|
Next we'll generate the `instances/cdr.vdhx` file, so we can run the following:
|
|
|
|
```bash
|
|
wsl --import cdr ./instances ./images/ubuntu-22-04-snapshot.tar
|
|
```
|
|
|
|
</Step>
|
|
|
|
<Step>
|
|
|
|
### Access your new instance as root
|
|
|
|
Now try to access your new Ubuntu 22.04 instance `cdr` as the `root` user by running:
|
|
|
|
```bash
|
|
wsl -d cdr
|
|
```
|
|
|
|
</Step>
|
|
|
|
<Step>
|
|
|
|
### Set 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:
|
|
|
|
```bash
|
|
nano /etc/wsl.conf
|
|
```
|
|
|
|
Modify the file by adding a `[user]` section with the value `default=rzmk` (where `rzmk` is your username). The file should look similar to this:
|
|
|
|
```ini
|
|
[boot]
|
|
systemd=true
|
|
|
|
[user]
|
|
default=rzmk
|
|
```
|
|
|
|
Now leave your instance:
|
|
|
|
```bash
|
|
exit
|
|
```
|
|
|
|
Then terminate the instance:
|
|
|
|
```bash
|
|
wsl --terminate cdr
|
|
```
|
|
|
|
Run the instance again and you should be logged in as your admin user by default now:
|
|
|
|
```bash
|
|
wsl -d cdr
|
|
```
|
|
|
|
</Step>
|
|
|
|
<Step>
|
|
|
|
### Install ckan-devstaller
|
|
|
|
Great, now you can go to the home directory and run one of the [quick start](/docs) scripts:
|
|
|
|
```bash
|
|
cd ~/
|
|
```
|
|
|
|
</Step>
|
|
</Steps>
|
|
|
|
## 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:
|
|
|
|
```bash
|
|
wsl --unregister cdr
|
|
```
|
|
|
|
Then you can follow the steps again from step 3 to generate and try out a new instance.
|