This article will show you how to install Spring Boot Command Line Interface on Linux system, which includes RHEL, CentOS, Fedora, Debian, Ubuntu, etc. There are 2 ways for us to do that. The first is to install manually and the second is to install with SDKMAN. We will cover both of 2 ways in this article.
1. Prerequisites
- Spring Boot CLI requires Java 6 or above in order to run.
- JAVA_HOME environment variable should be set to a JDK
2. Install Spring Boot Command Line Interface on Linux
2.1. Install Spring Boot CLI Manually
2.1.1. Download Spring Boot CLI
You can visit Spring Boot repository to download the Spring Boot CLI version that you desire by following the below link:
http://repo.spring.io/release/org/springframework/boot/spring-boot-cli
Currently, the latest version is: 1.4.0
So, we will try to download the Spring Boot CLI 1.4.0.
You can download it using web browser or using wget command.
1 |
wget http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.4.0.RELEASE/spring-boot-cli-1.4.0.RELEASE-bin.tar.gz |
2.1.2. Extract the compressed file
We will extract the file to /opt/spring-boot folder
1 2 |
sudo mkdir /opt/spring-boot tar xzf spring-boot-cli-1.4.0.RELEASE-bin.tar.gz -C /opt/spring-boot |
2.1.3. Set SPRING_HOME environment variable
Edit the /etc/profile by any editor such as: vim, nano, and append following lines at the end of the file.
1 2 |
export SPRING_HOME=/opt/spring-boot/spring-1.4.0.RELEASE export PATH=$SPRING_HOME/bin:$PATH |
Then, issue below command make the environment variables effectively/
1 |
source /etc/profile |
2.1.4. Verify
To verify whether the Spring Boot CLI was installed successfully or not, we can issue below command:
1 |
spring --version |
The output should be:
1 |
Spring CLI v1.4.0.RELEASE |
Well done! we have just finished to install Spring Boot Command Line Interface on Linux manually.
2.2. Install Spring Boot CLI with SDKMAN
SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Spring Boot Command Line Interface on Linux.
2.2.1. Install SDKMAN
2.2.1.1. Open a terminal and enter:
1 |
curl -s "https://get.sdkman.io" | bash |
Note that, SDKMAN may ask you to install unzip package as the following:
1 2 3 4 5 6 7 8 |
Looking for a previous installation of SDKMAN... Looking for unzip... Not found. ======================================================================================== Please install unzip on your system using your favourite package manager. Restart after installing unzip. ======================================================================================== |
In that case, you simply need to install unzip using your favourite package manager. For example, I’m using Ubuntu; therefore, I use apt-get to install unzip
1 |
sudo apt-get install unzip |
So, if your OS is CentOS or RHEL, you can issue:
1 |
sudo yum install unzip |
2.2.1.2. Enter the following code snippet
1 |
source "$HOME/.sdkman/bin/sdkman-init.sh" |
2.2.1.3. Lastly, verify that installation succeeded
1 |
sdk version |
You should see the output:
1 2 3 4 5 6 |
==== BROADCAST ============================================================ * 21/08/16: Asciidoctorj 1.5.4.1 released on SDKMAN! #asciidoctorj * 15/08/16: Gradle 3.0 released on SDKMAN! #gradle * 08/08/16: Gradle 3.0-rc-2 released on SDKMAN! #gradle =========================================================================== SDKMAN 5.0.0+51 |
We have finished to install the SDKMAN, in the next section, we will install Spring Boot CLI.
2.2.2. Install the Spring Boot CLI
2.2.2.1. On the terminal, enter:
1 |
sdk install springboot |
2.2.2.2. Verify the installation.
We have finished to install Spring Boot Command Line Interface by using SDKMAN. Let’s verify whether the installation was successful or not.
On the terminal, enter:
1 |
spring --version |
1 |
Spring CLI v1.4.0.RELEASE |
3. Summary
We have finished to install Spring Boot Command Line Interface on Linux with manual way and SDKMAN. You can select any way you like. However, with SDKMAN, you will be easy to update and witch between different versions. In future posts, we’ll explore some popular commands of Spring Boot CLI. If you’re looking for install Spring Boot CLI on Windows, you can refer to the following post: Install Spring Boot Command Line Interface on Windows
Here is another post related to Spring Boot if you may be interested in:
How To Run A Spring Boot Application
How to Configure Logging in Spring Boot
Package a Spring Boot Application Into War File
JUnit 5 and Spring Boot Example