Step by step guide to develop a website using Grails Framework

Grails is;
  • Open source.
  • Web application framework.
  • Based on Java platform.
  • Uses Groovy programming language.
  • Follows "Coding by Convention" paradigm.
  • Ideal for rapid web developments.

What do I need to do before installing grails?

Install Java Development Kit (JDK) in your computer. Required version of Java will differ according to your grails version. But all latest grails versions need Java 1.6 or newer.
Set JAVA_HOME and PATH environment variables.

How to set JAVA_HOME?

In Windows go to My Computer properties (Control Panel\System and Security\System), go to Advanced System Settings --> Environment Variables. Create a new "System Variable". Variable name as JAVA_HOME and variable value is the path to your JDK installation folder (mine is 'C:\Program Files\Java\jdk1.7.0_05').

 Update PATH variable in System Variables as ;%JAVA_HOME%\bin

In Ubuntu change bashrc file. To do that edit .bashrc file using text editor like Gedit or VIM terminal editor.

export JAVA_HOME=/usr/lib/jvm/java-7-sun 
export PATH=$PATH:JAVA_HOME

How to install grails?

Windows:


  1. Download latest binary distribution (zip file) from Grails official page.
  2. Extract it to C:\
  3. Change extracted folder name (only if you need to :) )
  4. Set GRAILS_HOME just as we set JAVA_HOME above. 
  5. Add GRAILS_HOME to PATH variable too. To do that edit path as ;%GRAILS_HOME%\bin
  6. Open cmd prompt and type grails. This will start downloading some files. Don't worry it will only happen for the first time. Then it will ask your permission to send user experience information to VMware. Type "y" or "n" as you wish. 
  7. Then Windows security alert will ask for Firewall permission.
  8. Finally grails interactive mode will start. This means Grails has been installed correctly.
  9. To exit from Grails interactive mode type "quit".
Grails Interactive Mode

Ubuntu:

  1. Download latest binary distribution (zip file) from Grails official page.
  2. Extract it to a convenient place for you (may be under /home/user/)
  3. Set GRAILS_HOME in bashrc file.
  4. Set PATH.
export GRAILS_HOME=/home/user/grails
export PATH=$PATH:JAVA_HOME:GRAILS_HOME

Note: You can also use Open JDK with Grails development. When using openjdk-6-jdk or sun-java6-jdk package you do not need to set any of the JAVA_HOME or GRAILS_HOME variables.

That's it. We will create a demo app using Grails in next post.

Comments

Popular Posts