Installing Grails on CentOS

Grails ( is an open source web application framework which uses the Groovy programming language, which is based on Java. The official website contains comprehensive installation documentation, but this tends to be biased towards Debian/Ubuntu distros, with Red Hat/CentOS less well documented.

The following details steps taken to install Grails on a CentOS 5.7 64-bit server. If you are installing on a significantly different version, or a 32-bit build, please adjust downloads accordingly.

Before you can install Grails, you need to install the Java JDK.

Move into the build directory and download the bin file:

cd /usr/src/

This will generate a bin file with a large extension of random characters, which will be different each time, e.g. -


Turn this into something more usable by running:

mv jdk-6u25-linux-x64.bin jdk-6u25-linux-x64.bin

Then copy (or move if you prefer) it into the java directory:

cp jdk-6u25-linux-x64.bin /usr/java/

And run it:

sh /usr/java/jdk-6u25-linux-x64.bin

This will create a ‘jdk1.6.0_25′ folder in the /usr/java/ directory.

The use your preferred text editor to edit /root/.bash_profile and comment out the existing java path:

# export JAVA_HOME=/usr

And then add:

export JAVA_HOME
export PATH

Save changes and exit, and the Java JDK installation is complete.

Next, install Grails. In previous installations, we have installed it inside a user’s home directory, so let’s assume a path of ‘/home/test’.

To download, build and then install it, run:

cd /home/test
cd grails-1.3.7
./gradlew libs
./gradlew install

Next, open /root/.bashrc in a text editor and add:

export GRAILS_HOME=/home/test/grails-1.3.7
export PATH=${GRAILS_HOME}/bin:${PATH}

To test that it’s working, create a test project by running:

grails create-app YourProject

If everything is working correctly, eventually you should get a message like this:

Created Grails Application at /home/test/YourProject

Next, test the deployment of a WAR file to the project. You must be inside the project folder to do this, so run ‘cd /home/test/YourProject’ first, if not already inside the folder.

Then run:

grails war

If everything is okay, you should eventually see a message like this:

Done creating WAR /home/test/YourProject/target/YourProject-0.1.war

And that’s Grails installed.

Further reading:

*Install guide:
*Common command line options:

This entry was posted in Managed Hosting. Bookmark the permalink.

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>