Cyberithub

How to Install SDKMAN on Linux Using 7 Easy Steps

Advertisements

In this article, I will take you through the steps to install SDKMAN on Linux. SDKMAN is a free tool for managing parallel versions of multiple Software Development Kits on most Linux and Unix based systems. It provides an excellent Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. It was formerly known as GVM the Groovy environment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community. While this tool can be installed very easily on any of Linux or Unix distributions, here we will see the steps to install SDKMAN on Linux based systems.

 

How to Install SDKMAN on Linux Using 7 Easy Steps

How to Install SDKMAN on Linux Using 7 Easy Steps

Also Read: How to Install libomp-dev on Ubuntu 20.04 LTS (Focal Fossa)

Step 1: Prerequisites

a) You should have a running Linux System.

b) You should have sudo or root access to run privileged commands.

c) You should have curl utility available in your System.

 

Step 2: Update Your System

If you are using a Ubuntu/Debian based Linux system then you can update your server by using sudo apt update command as shown below.

cyberithub@ubuntu:~$ sudo apt update
[sudo] password for cyberithub:
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:4 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:6 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Hit:8 https://apt.boltops.com stable InRelease
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,752 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,127 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [728 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.7 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [735 kB]
Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [277 kB]

If you need to upgrade any packages then you need to run sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
isc-dhcp-client isc-dhcp-common thunderbird thunderbird-gnome-support thunderbird-locale-en thunderbird-locale-en-us ubuntu-advantage-tools zlib1g
zlib1g-dev
9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
6 standard security updates
Need to get 661 kB/59.2 MB of archives.
After this operation, 8,881 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
.................................................

If you are using any RHEL/CentOS based systems then you need to use sudo yum update or sudo dnf update command to update your System packages. To upgrade, you need to use sudo yum upgrade or sudo dnf upgrade command.

 

Step 3: Install SDKMAN

You can go to official website and get the script to install SDKMAN on Linux. As of now, you need to run below curl command to complete the installation.

cyberithub@ubuntu:~$ sudo curl -s "https://get.sdkman.io" | bash
[sudo] password for cyberithub:

                                 -+syyyyyyys:
                             `/yho:`       -yd.
                          `/yh/`             +m.
                        .oho.                 hy .`
                      .sh/`                   :N`                `-/o` `+dyyo:.
                    .yh:`                     `M-          `-/osysoym  :hs` `-+sys:      hhyssssssssy+
                  .sh:`                       `N:          ms/-``  yy.yh-      -hy.    `.N-````````+N.
                `od/`                         `N-       -/oM-       ddd+`    `sd:     hNNm        -N:
               :do`                           .M.       dMMM-      `ms.     /d+`     `NMMs       `do
             .yy-                             :N`    ```mMMM.       -     -hy.       /MMM:       yh
           `+d+`            `:/oo/`      `-/osyh/ossssssdNMM`           .sh:         yMMN`      /m.
          -dh-            :ymNMMMMy `-/shmNm-`:N/-.`` `.sN              /N-         `NMMy      .m/
        `oNs`          -hysosmMMMMydmNmds+-.:ohm         :               sd`        :MMM/      yy
       .hN+           /d: -MMMmhs/-.`      .MMMh  .ss+-                  `yy`       sMMN`     :N.
      :mN/           `N/  `o/-`            :MMMo  +MMMN-        .`        `ds       mMMh      do
     /NN/            `N+....--:/+oooosooo+:sMMM:  hMMMM:       `my         .m+     -MMM+     :N.
    /NMo              -+ooooo+/:-....`...:+hNMN. `NMMMd`       .MM/         -m:    oMMN.     hs
   -NMd`                                     :mm -MMMm- .s/    -MMm.         /m-   mMMd     -N.
  `mMM/                                       .- /MMh. -dMo    -MMMy          od. .MMMs..---yh
  +MMM.                                          sNo`.sNMM+    :MMMM/          sh`+MMMNmNm+++-
  mMMM-                                          /--ohmMMM+    :MMMMm.         `hyymmmdddo
  MMMMh.                  ````                 `-+yy/`yMMM/    :MMMMMy         -sm:.``..-:-.`
  dMMMMmo-.``````..-:/osyhddddho.          `+shdh+.   hMMM:    :MmMMMM/     ./yy/` `:sys+/+sh/
  .dMMMMMMmdddddmmNMMMNNNNNMMMMMs          sNdo-      dMMM-    `-/yd/MMMMm-:sy+.  :hs-      /N`
   `/ymNNNNNNNmmdys+/::----/dMMm:         +m-         mMMM+ohmo/.` sMMMMdo-     .om:       `sh
      `.-----+/.` `.-+hh/`              `od.          NMMNmds/     `mmy:`      +mMy       `:yy.
            /moyso+//+ossso:.          .yy`          `dy+:`         ..        :MMMN+---/oys:
          /+m: `.-:::-`               /d+                                     +MMMMMMMNh:`
         +MN/                       -yh.                                      `+hddhy+.
        /MM+                      .sh:
       :NMo                     -sh/
      -NMs                   `/yy:
     .NMy                 `:sh+.
    `mMm`              ./yds-
   `dMMMmyo:-.````.-:oymNy:`
   +NMMMMMMMMMMMMMMMMms:`
     -+shmNMMMNmdy+:`


Now attempting installation...


Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...

Set version to 5.16.0 ...
Set native version to 0.0.15 ...
Attempt update of interactive bash profile on regular UNIX...
Added sdkman init snippet to /home/cyberithub/.bashrc
Attempt update of zsh profile...
Updated existing /home/cyberithub/.zshrc




All done!


You are subscribed to the STABLE channel.

Please open a new terminal, or run the following in the existing one:

source "/home/cyberithub/.sdkman/bin/sdkman-init.sh"

Then issue the following command:

sdk help

Enjoy!!!

 

Step 4: Update the Changes

To update the changes done in the system, you need to run below script as mentioned on the previous step output.

cyberithub@ubuntu:~$ source "/home/cyberithub/.sdkman/bin/sdkman-init.sh"

 

Step 5: Check Version

You can verify the successful installation of SDKMAN by running sdk version command as shown below.

cyberithub@ubuntu:~$ sdk version
==== BROADCAST =================================================================
* 2022-10-05: jbang 0.99.0 available on SDKMAN! https://github.com/jbangdev/jbang/releases/tag/v0.99.0
* 2022-10-03: vertx 4.3.4 available on SDKMAN!
* 2022-09-29: kotlin 1.7.20 available on SDKMAN! https://github.com/JetBrains/kotlin/releases/v1.7.20
================================================================================

SDKMAN 5.16.0

 

Step 6: Install a Package

Now that SDKMAN is successfully installed, it is time to test the package manager by installing a sample package. Here we are installing Java package of version 17.0.0-tem using sdk install java 17.0.0-tem command as shown below.

cyberithub@ubuntu:~$ sdk install java 17.0.0-tem

Downloading: java 17.0.0-tem

In progress...

###################################################################################################################################################### 100.0%

Repackaging Java 17.0.0-tem...

Done repackaging...

Installing: java 17.0.0-tem
Done installing!


Setting java 17.0.0-tem as default.

 

Step 7: Check all the available options

You can check all the options available with sdk utility using sdk help command as shown below.

cyberithub@ubuntu:~$ sdk help

NAME
sdk - The command line interface (CLI) for SDKMAN!

SYNOPSIS
sdk <subcommand> [candidate] [version]

DESCRIPTION
SDKMAN! is a tool for managing parallel versions of multiple JVM related
Software Development Kits on most Unix based systems. It provides a
convenient Command Line Interface (CLI) and API for installing, switching,
removing and listing Candidates.

SUBCOMMANDS & QUALIFIERS
help [subcommand]
install <candidate> [version] [path]
uninstall <candidate> <version>
list [candidate]
use <candidate> <version>
config no qualifier
default <candidate> [version]
home <candidate> <version>
env [init|install|clear]
current [candidate]
upgrade [candidate]
version no qualifier
broadcast no qualifier
offline [enable|disable]
selfupdate [force]
update no qualifier
flush [tmp|broadcast|metadata|version]

EXAMPLES
sdk install java 17.0.0-tem
sdk help install

Leave a Comment