Automatically upgrading Ubuntu on WSL to the latest release
As I use multiple Windows machines, all running the identical setup of WSL (Ubunto) I wanted to keep all these instances automatically updated.
I am using Ansible scripts to set up the WSL. While all the files are hosted on the file system (\mtn\c\…) I can throw away a WSL instance and create a new one within minutes.
While many packages are not available on Ubunto 18.04 LTS, I created a small Ansible task upgrading my WSL to the latest Ubuntu version available.
- Start your WSL instance the very first time and run sudo apt-get update
- Install ansible by running sudo apt-get install ansible
- Make sure the Ansible scripts are located on the host system (e.g. c:\dev\…)
- Start your WSL instance and change e.g. to /mnt/c/dev
- Run your Ansible playbook as sudo
You can check your dist version with lsb_release -a:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 19.04 Release: 19.04 Codename: disco
The Ansible tasks can be found here.
GitHub Gist: https://gist.github.com/aheil/6d48a77ac44c83e00666d3c49ffd7890