The 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.
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. Also, take a look at our ultra-fast managed Grails hosting plans. Thanks.
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).
Hello Sola,
Can you please help me with a howto for setting up grails production environment with postgresql and tomcat. Appreciate your help.
how to know grails path(installed location) in order to set path in eclipse?
hi,
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 .
Hello, thanks for the tips, just to
## source ~/.gvm/bin/gvm-init.sh
as for know, I don’t find this path so I use instead:
## source ~/.sdkman/bin/sdkman-init.sh