In this article, I write down how to intall Maven into Ubuntu(WSL2). I don't explain what Maven is. If you want to know it, please read Maven – Welcome to Apache Maven page.
At the fist, you need to update your Ubuntu repogitory to the latest using the following command:
[Ubuntu: ~]$sudo apt update
Then, upgrade Ubuntu:
[Ubuntu: ~]$sudo apt upgrade
Check that OS is upgraded/updated as follows:
[Ubuntu: ~]$cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Install maven:
[Ubuntu: ~]$sudo apt install maven
Reading package lists... Done
Building dependency tree
Reading state information... Done
maven is already the newest version (3.6.3-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Check maven version installed into your enviroment:
[Ubuntu: ~]$mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.72-microsoft-standard-wsl2", arch: "amd64", family: "unix"
That's it!