How to install Groovy on Amazon Linux 2 machine
Overview:
Amazon Linux 2 machine (centos rhel fedora)
To check version of the machine use:
cat /etc/os-release
Groovy is a scripting language with Java-like syntax for the Java platform. It is managed by Apache Software Foundation.
This post shows how to install Groovy via SDKMan
Install SDKMan:
- Download SDKMAN:
curl -s "https://get.sdkman.io" | bash
- Execute installation script and populate variables:
source "$HOME/.sdkman/bin/sdkman-init.sh"
- Check if the installation has succeded:
sdk version
Java configuration:
- Ensure that you have Java installed on your machine:
java --version
- Copy the path to the Java folder:
ls /usr/lib/jvm
- Set
JAVA_HOME
environment variable:vim ~/.bashrc
- Add the following entries, close and save the file:
export JAVA_HOME="/usr/lib/jvm/[java_folder]/" export PATH=$PATH:$JAVA_HOME/bin
- Load variables:
source ~/.bashrc
Groovy install:
- Set the executable bit on
sdkman-init.sh
:chmod +x ~/.sdkman/bin/sdkman-init.sh
- Install Groovy:
sdk install groovy
- Check groovy version:
groovy -version
Notes:
source
is a built-in shell command that reads and executes the file content in the current shell. These files usually contain a list of commands.. bash_profile
and. bashrc
are files containing shell commands that are run when Bash is invoked