Cloud VPS Hosting

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.

UPDATE THE SYSTEM

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

INSTALL JAVA

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.

a) INSTALL OPEN SOURCE JAVA

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

## apt-get install openjdk-7-jdk

b) INSTALL ORACLE JAVA

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

– VERIFY JAVA INSTALLATION

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

## java -version

INSTALL SDKMAN

Installing SDKMAN , formerly known as 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 "https://get.sdkman.io" | bash

load the sdkman-init.sh script in your environment using:

## source ~/.sdkman/bin/sdkman-init.sh
## 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:

## sdk install grails

SET-UP TEST GRAILS PROJECT

## 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 http://grails.org/doc/latest/


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.