Skip to main content

Install Spring Boot in Ubuntu with SDKMAN! | Complete Guide

In this detailed guide, we will see how to install Spring Boot on Ubuntu with SDKMAN!, configure the development environment, and start your first application. If you work with Java on Linux, this guide will help you get started quickly with Spring Boot.

Prerequisites

To follow this guide, you will need:

  • A server or computer with Ubuntu 22.04 or 24.04 installed
  • Access as a user with sudo privileges
  • A stable Internet connection

Install JDK on Ubuntu

Spring Boot requires Java Development Kit (JDK). Here's how to install it:

sudo apt update
sudo apt install default-jdk

You can verify the installation with the following command:

java -version
openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)
OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)

Installing Maven and Gradle in Ubuntu

Spring Boot can be built using Maven or Gradle. Here's how to install them:

sudo apt-get install maven
sudo apt install gradle

Install SDKMAN!

SDKMAN! It is a tool that allows you to easily manage multiple versions of SDKs for Java, including Spring Boot. To install it, we can follow the following steps:

  1. Install the dependencies of SDKMAN!:

    sudo apt install curl zip
  2. Launch the installation script downloaded from the official website:

    sudo curl -s "https://get.sdkman.io" | bash
    All done!
    You are subscribed to the STABLE channel.
    Please open a new terminal, or run the following in the existing one:
        source "/root/.sdkman/bin/sdkman-init.sh"
    Then issue the following command:
        sdk help
  3. Let's source the sdkman-init.sh

    sudo source "/root/.sdkman/bin/sdkman-init.sh"
  4. Let's verify the installation of SDKMAN!

    sudo sdk help

Install Spring Boot in Ubuntu

  1. To install Spring Boot on Ubuntu we use SDKMAN! Which we just installed:

    sudo sdk install springboot
  2. This command will install the latest stable version of Spring Boot.

    Downloading: springboot 3.3.4
    In progress...
    ############################# 100.0%
    Installing: springboot 3.3.4
    Done installing!
    Setting springboot 3.3.4 as default.
  3. To use an alternate version of Spring Boot

    sudo sdk ls springboot
    ================================================================================
    Available Springboot Versions
    ================================================================================
     > * 3.3.4 2.5.5 2.1.8.RELEASE 1.4.7
         3.3.3 2.5.4 2.1.8 1.4.6.RELEASE 
  4. Specifying the version with sdk install springboot x.x.x e.g.

    sdk install springboot 3.3.3

Frequently Asked Questions (FAQ)

1. What is the minimum version of Java required for Spring Boot?

Spring Boot requires at least JDK 8, but it is recommended to use JDK 11 or later.

2. Can I use Spring Boot with Gradle on Ubuntu?

Yes, you can configure and use Gradle with Spring Boot. Follow the guide above to install Gradle and configure your project.

3. How can I run a Spring Boot app?

You can run a Spring Boot app with the command mvn spring-boot:run or gradle bootRun, depending on the tool you use.

Conclusion

In this guide we have seen how to configure the development environment for Spring Boot on Ubuntu, installing Maven, Gradle and Spring Boot via SDKMAN! If you need more information or assistance, please see the external resources or contact us for our consulting service.

Java Dedicated Hosting Consultation

Trust one of our experienced Linux system builder to manage your Java application hosting efficiently. Now 30 minutes of Free consultation!"

Add new comment

Comment

  • Allowed HTML tags: <br> <p> <code class="language-*"> <pre>
  • Lines and paragraphs break automatically.
  • Only images hosted on this site may be used in <img> tags.