Development Tools

This guide covers installing the essential development tools for Java and Angular development in WSL2.

1. Java Development Kit (OpenJDK)

1.1. Install OpenJDK 21

Install OpenJDK 21 from Ubuntu’s package repository:

sudo apt update
sudo apt install openjdk-21-jdk -y

Verify the installation:

java --version
javac --version

Expected output:

openjdk 21.0.x 2024-xx-xx
OpenJDK Runtime Environment (build 21.0.x+xx-Ubuntu-...)
OpenJDK 64-Bit Server VM (build 21.0.x+xx-Ubuntu-..., mixed mode, sharing)

1.2. Set JAVA_HOME

Add JAVA_HOME to your shell configuration:

echo 'export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64' >> ~/.bashrc
source ~/.bashrc

Verify:

echo $JAVA_HOME

1.3. Alternative: SDKMAN for multiple JDK versions

If you need to manage multiple Java versions, use SDKMAN:

# Install SDKMAN
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

# Install Java versions
sdk install java 21.0.2-tem
sdk install java 17.0.10-tem

# Switch between versions
sdk use java 21.0.2-tem

2. Apache Maven

2.1. Install Maven

Install Maven from Ubuntu’s package repository:

sudo apt install maven -y

Verify the installation:

mvn --version

Expected output:

Apache Maven 3.9.x
Maven home: /usr/share/maven
Java version: 21.0.x, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64
...

2.2. Configure Maven settings (optional)

If you need custom Maven settings (e.g., for private repositories):

mkdir -p ~/.m2
nano ~/.m2/settings.xml

3. Node.js

3.1. Check for existing installations

Ubuntu may have an older Node.js version pre-installed. Check first:

node --version
which node

If you have an old version (e.g., v16.x) installed via apt, remove it before installing the new version:

sudo apt remove nodejs npm -y
sudo apt autoremove -y

3.2. Install Node.js 20

Install Node.js 20 LTS using the NodeSource repository:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs -y

Verify the installation:

node --version
npm --version

Expected output:

v20.x.x
10.x.x

If you need to manage multiple Node.js versions, consider using nvm instead. However, ensure you uninstall any apt-installed Node.js first to avoid conflicts.

4. Angular CLI

4.1. Install Angular CLI globally

After installing Node.js, install the Angular CLI:

npm install -g @angular/cli

Verify the installation:

ng version

4.2. Configure npm global path (if needed)

If you encounter permission errors with global npm packages, configure npm to use a user directory:

mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

5. Git

5.1. Install Git

Git is usually pre-installed in Ubuntu. If not:

sudo apt install git -y

5.2. Configure Git

Set your identity:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Configure line endings for cross-platform development:

git config --global core.autocrlf input
git config --global core.eol lf

5.3. Generate SSH key for GitHub

Generate an SSH key pair:

ssh-keygen -t ed25519 -C "[email protected]"

Press Enter to accept the default file location and optionally set a passphrase.

Start the SSH agent and add your key:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Display the public key to copy to GitHub:

cat ~/.ssh/id_ed25519.pub

Add this key to your GitHub account:

  1. Go to https://github.com/settings/keys

  2. Click New SSH key

  3. Paste your public key and save

Test the connection:

6. Liquibase CLI

6.1. Download and install Liquibase

# Download Liquibase
cd /tmp
curl -L https://github.com/liquibase/liquibase/releases/download/v4.29.2/liquibase-4.29.2.tar.gz -o liquibase.tar.gz

# Extract to /opt
sudo mkdir -p /opt/liquibase
sudo tar -xzf liquibase.tar.gz -C /opt/liquibase

# Add to PATH
echo 'export PATH="$PATH:/opt/liquibase"' >> ~/.bashrc
source ~/.bashrc

Verify the installation:

liquibase --version

Check https://github.com/liquibase/liquibase/releases for the latest version and update the download URL accordingly.

7. Azure CLI

7.1. Install Azure CLI

Install using the convenience script:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Verify the installation:

az --version

7.2. Authenticate with Azure

Log in to Azure:

az login

This opens a browser window for authentication. After successful login, your subscriptions are displayed.

7.3. Configure Azure DevOps extension

Install the Azure DevOps extension:

az extension add --name azure-devops

Configure defaults for your organisation:

az devops configure --defaults organization=https://dev.azure.com/YourOrg project=YourProject

8. Kubernetes tools

8.1. Install kubectl

Install kubectl using the official method:

# Download the kubectl binary
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

# Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

# Clean up
rm kubectl

Verify the installation:

kubectl version --client

8.2. Install Helm (optional)

If you work with Helm charts:

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Verify:

helm version

9. GitHub CLI (optional)

The GitHub CLI provides convenient access to GitHub features from the command line.

9.1. Install GitHub CLI

sudo apt install gh -y

9.2. Authenticate with GitHub

gh auth login

Follow the prompts to authenticate via browser or token.

9.3. Useful commands

# Clone a repository
gh repo clone owner/repo

# Create a pull request
gh pr create

# View pull request status
gh pr status

# Check out a pull request locally
gh pr checkout 123

10. Automated installation script

You can use the automated script to install all development tools at once. See the Workspace Setup guide for details.

11. Verify all installations

Run these commands to verify all tools are installed correctly:

echo "Java: $(java --version 2>&1 | head -1)"
echo "Maven: $(mvn --version 2>&1 | head -1)"
echo "Node.js: $(node --version)"
echo "npm: $(npm --version)"
echo "Angular CLI: $(ng version 2>&1 | grep 'Angular CLI' || echo 'not installed')"
echo "Git: $(git --version)"
echo "Liquibase: $(liquibase --version 2>&1 | head -1)"
echo "Azure CLI: $(az --version 2>&1 | head -1)"
echo "kubectl: $(kubectl version --client --short 2>/dev/null || kubectl version --client 2>&1 | head -1)"
echo "GitHub CLI: $(gh --version 2>&1 | head -1 || echo 'not installed')"

12. Next steps

Proceed to Claude Code Setup to install and configure Claude Code for AI-assisted development.