-
wsl --update
-
wsl --install -d Ubuntu-24.04
-
Create initial user.
-
Setup your init.sh (One Command Setup) script.
-
Clone this repo to your home directory.
-
sudo su -
-
Move the cloned repo under /opt/
-
Copy the
/opt/dev_env_setup/wsl_u24.04/wsl.conf
file under/etc/
-
(Optional): Copy the required certificates to the WSL intance:
-
Copy the required certs from Windows to the WSL instance:
cp /mnt/c/cert_for_wsl/* /usr/local/share/ca-certificates/ ; chmod 644 /usr/local/share/ca-certificates/* ; ll /usr/local/share/ca-certificates/
-
Update and Upgrade:
apt update ; apt upgrade
-
Refresh all the certs:
update-ca-certificates --fresh
-
-
Now run the setup script:
1. Login again and udpate the dns server names:
```bash
bash /opt/dev_env_setup/wsl_u24.04/01_run_as_root.sh SKIP_ROOT_PASS ; unlink /etc/resolv.conf ; echo -e "nameserver 1.1.1.1\nnameserver 1.0.0.1" > /etc/resolv.conf
-
Exit and shutdown the WSL instance:
wsl --shutdown
-
Wait 10 seconds.
-
Now you can start using your fully setup WSL instance.
When using WSL (or any VM that is provisioned by the user and not the company) on a corporate machine/network we usually need to import the company's certificates on the WSL instance, this is because companies usually implement SSL MITM to monitor all traffic to prevent get malware into the company's network.
- On the WSL machine, clone this repo under
/opt/
- On the Windows machine:
-
Create a folder directly under the
c
drive using powershell:New-Item -ItemType "directory" -Path "c:\cert_for_wsl"
-
Copy the company certificates to
c:\cert_for_wsl
-
Important
The steps below are provided so the user know what's the process to do so but this should be part of the automation setup process.
- On the Ubuntu WSL instance
-
Log in as root.
-
Update certs:
sudo update-ca-trust
-
Copy the required certs from Windows to the WSL instance:
cp /mnt/c/cert_for_wsl/* /usr/local/share/ca-certificates/ ; chmod 644 /usr/local/share/ca-certificates/*
-
Refresh all the certs:
sudo update-ca-certificates --fresh
-
Important
The steps below are provided so the user know what's the process to do so but this should be part of the automation setup process.
- On the RHEL WSL instance:
-
Log in as root.
-
Update certs:
update-ca-trust
-
Copy the required certs from Windows to the WSL instance:
cp /mnt/c/cert_for_wsl/* /etc/pki/ca-trust/source/anchors/ ; chmod 644 /etc/pki/ca-trust/source/anchors/*
-
Refresh all the certs:
update-ca-trust extract`
-
-
Completely Uninstall Docker from Ubuntu:
dpkg -l | grep -i docker ; sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli ; sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce ; sudo rm -rf /var/lib/docker /etc/docker ; sudo rm /etc/apparmor.d/docker ; sudo groupdel docker ; sudo rm -rf /var/run/docker.sock
-
Load scripts from
/etc/profile.d/
by Adding the following to the~/.bashrc
of the 1st created user:Note: This is not needed as automation takes for this but leaving here just in case
if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi
- Go to Manage User Certificates
- Trusted Root Certification Authorities
- Certificates
- Open the root CA certificate you are interested in
- Details
- Copy To File
- Next
- Select "Base64 encoded X.509"
- Important: Save the certs using the .crt extension to a share location
- Go to the RHEL machine
sudo update-ca-trust
sudo cp <path_to_crt_file>/* /etc/pki/ca-trust/source/anchors/
update-ca-trust extract
- Now let's verify we can reach https websites
curl https:///example.com
- Go to Manage User Certificates
- Trusted Root Certification Authorities
- Certificates
- Open the root CA certificate you are interested in
- Details
- Copy To File
- Next
- Select "Base64 encoded X.509"
- Important: save the certs using the .crt extension to a share location
- Go to the Ubuntu machine
sudo update-ca-trust
sudo cp <path_to_crt_file>/* /usr/local/share/ca-certificates/
sudo update-ca-certificates --fresh
- Now let's verify we can reach https websites
curl https:///example.com