How to install Groovy on Linux system-wide

Groovy Logo
Image by Zorak1103 – CC BY-SA 3.0

(see section UPDATE at the bottom of the post to install Groovy using sdkman)

A colleague of mine recently asked me to install the Groovy programming language on our Red Hat 6.5 server and to make it accessible to all users. I thought it would be a very straightforward task but a quick search on the Red Hat 6.5 official repositories didn’t return any package for Groovy.

The easiest way to install Groovy manually is via gvm. I followed this  procedure to do it:

  1. Log in as root

2.  Retrieve the gvm install script and store it in a temporary file

3. Make the temporary file executable

4. Run the install script

5. Complete the installation as requested at prompt

6. Check that gvm is installed (this should return the help message explaining how to use gvm)

7. Remove the temporary install script

8. Install groovy via gvm

9. Select the current version of groovy as default (at the time of writing version 2.4.3)  and check that groovy is installed

10. Create a symlink to use groovy system-wide

11. Exit the root user

12. Check that groovy is installed system-wide

 

UPDATE:

Recently I had to install groovy on other Linux systems and discovered that that it is now much easier using sdkman, which is the evolution of gvm. This is the procedure to follow:

  1. Make sure you have Java installed by running:

If you don’t have Java, follow these instructions to install the default JRE/JDK or Oracle JDK.

2.  Install sdkman and set it up:

3. Check that sdkman is correctly installed:

4. Install groovy:

5. Check that groovy is correctly installed:

 

Happy grooving!

Leave a Reply

Your email address will not be published. Required fields are marked *