Install Grails on Fedora 23

Prerequisites:

  • JDK must be installed in the system.
  • Note: Check the compatibility of JDK version with Grails version.
  • Note: Grails 2.3.x have issues with JDK8, so use JDK7 with it instead.

Check JDK installation:

Check java version by running the command:

java -version

You will get an output similar to below depending on the version installed:

java version “1.8.0_66”
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Check whether JAVA_HOME is set by running the command:

echo $JAVA_HOME

If you get blank output, i.e., JAVA_HOME is not set, perform next step.

Set JAVA_HOME:

  1. Check for jdk path, you should have a jdk path similar to “/usr/java/jdk1.8.0_66” depending on the JDK installed.
  2. Open the file /etc/profile in edit mode using a file editor as follows:

    sudo vi /etc/profile
    or,
    sudo gedit /etc/profile

  3. Append the following line at the end of the “/etc/profile” file:

    export JAVA_HOME=/usr/java/jdk1.8.0_66

    The path will be the same jdk path as found in step 1.

Grails Installation steps:

  1. Download the latest or previous version of Grails archive from the link [1]. The downloaded archive file will look similar to grails-2.3.7.zip, depending on the version downloaded.
  2. Copy the archive file to /opt/ location by running the command:

    sudo cp ~/Downloads/grails-2.3.7.zip /opt/

  3. Go to /opt folder and extract the grails-2.3.7.zip archive file by running the command:

    cd /opt/
    sudo unzip grails-2.3.7.zip

    A folder named “grails-2.3.7” will be created. Note that the folder name will vary depending on the downloaded version of archive file.

  4. Delete the archive file “grails-2.3.7.zip” by running the command:

    sudo rm grails-2.3.7.zip

  5. Open the file /etc/profile in edit mode using a file editor, and append the following line at the end:

    export GRAILS_HOME=/opt/grails-2.3.7 export PATH=$GRAILS_HOME/bin:$PATH

  6. Check if the grails is properly installed by running the command:

    grails -version

    You should get an output similar to below:

    Grails version: 2.3.7

  7. Note: Changes made in /etc/profile are not reflected immediately, but are reflected after you logout, and re-login. To reflect the changes immediately run the following command:

    source /etc/profile

  8. Another way to check if the PATH is updated properly in step 5, is by checking the value of PATH variable, using the command:

    echo $PATH

    The location “/opt/grails-2.3.7/bin” (or similar location depending on grails version), should be present in the PATH variable value, otherwise run command in step 7, and re-check.

References:

  1. https://grails.org/download.html
  2. https://grails.org/wiki/Installation

Leave a comment