Install and set-up JAVA & Grails on an Ubuntu 14.04 Linux VPS

install-and-set-up-java-grails-on-a-ubuntu-14-04-linux-vpsThe following article covers the steps used to install and set-up JAVA & Grails on an Ubuntu 14.04 Linux VPS.

What is Grails?

It is an open source web application framework that uses the Groovy programming language which is in turn based on the Java platform.


Before you proceed with the installation of Grails and JAVA, make sure you have initiated a new screen session and your Ubuntu 14.04 VPS is fully up-to-date by running the commands below:

## screen -U -S grails-screen
## apt-get update
## apt-get upgrade


Grails can run either under the open source implementation of JAVA or the one provided by Oracle. We will cover the steps of installing both of them, so you can choose which one you want to use.

NOTE: You have to use one JAVA version only. Either use the open source version or the one provided by Oracle. You don’t have to install both JAVA versions.


Installing the open source implementation of JAVA 7 can’t be easier than issuing the following command:

## apt-get install openjdk-7-jdk


The best and recommended way to install Oracle JAVA is to use a PPA and install JAVA using apt as in:

## apt-get install software-properties-common
## add-apt-repository ppa:webupd8team/java
## apt-get update
## apt-get install oracle-java8-installer
## apt-get install oracle-java8-set-default


To verify if JAVA has been successfully installed and set-up, run the following command:

## java -version


Installing GVM (Grails/Groovy environment) is done by their automatic shell script installer. You need curl to download and run the script, so run the following commands:

## apt-get install curl
## curl -s | bash

load the script in your environment using:

## source ~/.gvm/bin/
## gvm help

Once the GVM package manager is installed and set-up on your Ubuntu 14.04 VPS, use the following command to install grails:

## gvm install grails


## mkdir /projects
## grails create-app /projects/test-project
## cd /projects/test-project
## grails run-app

Once the Grails application is deployed, you can access it at http://SERVER_IP:8080/projects/test-project . To learn more about Grails, refer to their official documentation at

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How to Install CachetHQ on an Ubuntu 16.04 VPS
How to install Tomcat 8 on Debian 8
How to install and use Rkhunter on a Linux server for rootkit, local exploits, malware and backdoors scanning
  • sola


    Author Reply

    Nice howto for Grails installation.

    One thing I would note as important: This howto is for the setup for Grails “development” mode, not a “production” mode. Usually, development mode is used on the workstations of developers and production mode is used on VPS-es. Naturally, you can install Grails in dev mode on a VPS but keep in mind that Development mode results in much-much slower Grails application execution than the proper production mode.

    Production mode for Grails is usually done by creating a WAR distribution file in the dev environment and deploying the WAR into a Java app server (like Tomcat). Of course, this in only the gist, it is more involved than the above (configuring a db, setting production configuration properties…etc).

    • Hari


      Author Reply

      Hello Sola,

      Can you please help me with a howto for setting up grails production environment with postgresql and tomcat. Appreciate your help.

  • Emmanuel


    Author Reply

    how to know grails path(installed location) in order to set path in eclipse?

    • admin


      Author Reply


      I’m not sure what grails path your need to specify in your eclipse nor how eclipse uses grails, but grails should be installed in /usr/share/grails .

  • bitsnaps


    Author Reply

    Hello, thanks for the tips, just to
    ## source ~/.gvm/bin/
    as for know, I don’t find this path so I use instead:
    ## source ~/.sdkman/bin/

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now