UbuntuUbuntu Based

How To Install SDKMAN on Ubuntu 24.04 LTS

Install SDKMAN on Ubuntu 24.04

Managing multiple Software Development Kits (SDKs) on Unix-based systems can be a daunting task, especially in diverse development environments. This is where SDKMAN comes into play. SDKMAN is a powerful tool that simplifies the process of managing and switching between different versions of SDKs, such as Java, Gradle, and Maven, on your system. In this article, we will guide you through the step-by-step process of installing SDKMAN on Ubuntu 24.04 LTS, a popular and stable Linux distribution.

As developers, we often work on projects that require different versions of SDKs, and manually managing these versions can lead to conflicts and inconsistencies. SDKMAN addresses this issue by providing a centralized platform for managing SDKs, allowing you to easily install, switch, and remove different versions without affecting your system’s stability. Ubuntu 24.04 LTS, with its long-term support and robustness, is an ideal choice for setting up a development environment and installing SDKMAN on this distribution is a straightforward process.

Prerequisites

Before we dive into the installation process, let’s ensure that your system meets the necessary requirements:

  • Your system should be running Ubuntu 24.04 LTS with an active internet connection.
  • You should have a non-root sudo user or root access to perform the installation.
  • A basic understanding of the Linux command-line interface (CLI) is helpful but not mandatory.

Preparing the System

To ensure a smooth installation process, it’s crucial to update your system packages to their latest versions. Open a terminal and run the following commands:

sudo apt update && sudo apt upgrade -y

These commands will refresh the package list and upgrade any outdated packages to their latest versions, ensuring that your system is up-to-date and compatible with SDKMAN.

Installing SDKMAN

Now that your system is prepared, let’s proceed with the installation of SDKMAN. Follow these step-by-step instructions:

Step 1: Install Necessary Tools

SDKMAN requires the curl and zip utilities to function properly. If these tools are not already installed on your system, you can install them by running the following command:

sudo apt install curl zip -y

curl is used to download the SDKMAN installation script, while zip is required for extracting and installing SDKs.

Step 2: Download and Execute SDKMAN Script

To download and execute the SDKMAN installation script, run the following command in your terminal:

curl -s "https://get.sdkman.io" | bash

This command downloads the installation script from the official SDKMAN website and executes it using the bash shell. Follow the on-screen prompts to complete the installation process.

Step 3: Initialize SDKMAN

After the installation script finishes, you need to initialize SDKMAN by running the following command:

source "$HOME/.sdkman/bin/sdkman-init.sh"

This command loads the SDKMAN initialization script into your current shell session, enabling you to use SDKMAN commands immediately.

Verifying Installation

To verify that SDKMAN is installed correctly, run the following command:

sdk version

If the installation was successful, you should see the version number of SDKMAN displayed in the terminal. If you encounter any errors or the command doesn’t work, double-check that you followed the installation steps correctly and try again.

Using SDKMAN

With SDKMAN installed, you can now manage your SDKs effortlessly. Here are some basic commands to get you started:

Listing Available SDKs

To see a list of available SDKs that you can install using SDKMAN, run the following command:

sdk list

This command will display a comprehensive list of SDKs supported by SDKMAN, along with their available versions.

Installing an SDK

To install a specific version of an SDK, such as Java, use the following command:

sdk install java <version>

Replace <version> with the desired version number. For example, to install Java 17, you would run:

sdk install java 17.0.1-open

Switching Between SDK Versions

If you have multiple versions of an SDK installed, you can easily switch between them using the following command:

sdk use java <version>

Replace <version> with the version you want to switch to. This command will set the specified version as the default for your current shell session.

Uninstalling an SDK

If you no longer need a specific version of an SDK, you can remove it using the following command:

sdk uninstall java <version>

Replace <version> with the version you want to remove. This command will delete the specified version from your system.

Updating SDKMAN and SDKs

To keep SDKMAN and your installed SDKs up-to-date, run the following commands:

sdk self-update
sdk upgrade

The self-update command updates SDKMAN itself to the latest version, while the upgrade command updates all installed SDKs to their latest available versions.

Uninstalling SDKMAN

If you decide that you no longer need SDKMAN on your system, you can remove it by following these steps:

  1. Remove the SDKMAN directory by running the following command:

rm -rf "$HOME/.sdkman"

  1. Remove the SDKMAN initialization line from your shell configuration files (e.g., ~/.bashrc, ~/.zshrc).

Troubleshooting Common Issues

While installing and using SDKMAN is generally straightforward, you may encounter some common issues. Here are a few troubleshooting tips:

Installation Errors

If you experience errors during the installation process, ensure that you have a stable internet connection and that you have the necessary permissions to write to the installation directory. Double-check that you have followed the installation steps correctly and try running the commands again.

SDK Version Conflicts

If you encounter issues when switching between SDK versions or running applications with specific versions, ensure that you have properly set the desired version using the sdk use command. Check that your application’s configuration files are pointing to the correct SDK version.

Congratulations! You have successfully installed SDKMAN. Thanks for using this tutorial for installing SDKMAN on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official SDKMAN website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button