This is the next article from Groovy and Grails Part 1 – Introduction that you can read it here. Now we continue to install Grails on your machine. Before you continue, there are some requirements to run Grails on your machine, so please read carefully ๐
Requirements to install Grails:
- Java SDK 1.4 or higher and have set your JAVA_HOME variable to the SDK install location. Note: Java OpenSDK and JRE are not working with Grails.
- Apache Ant 1.6.5 or higher *
- JUnit (to run the build tests – put junit.jar in your ANT_HOME/lib directory) *
- Subversion client *
Note: *, if you are planning to install Grails from SVN, to keep your installation up to date.
Steps to install Grails from binary release:
1. Download Grails binary Zip or Tar/Gz.
2. Extract to any location in your drive, usually in C:grails (on Windows), ~/grails (on Linux).
3. Create a GRAILS_HOME environment variable that points to the path where you extracted the archive (e.g. C:grails on Windows or ~/grails on Unix).
4. Check if JAVA_HOME is already set in environment variable, if not set it now.
5. Append a reference to the “bin” directory within the Grails directory to your PATH variable (e.g. %GRAILS_HOME%bin on Windows or $GRAILS_HOME/bin on Unix).
6. Type “grails” at the command line, if a help message is displayed you are ready.
7. On Linux, if you get an error message, try to chmod +x the grails script inside the bin directory.
Steps to install Grails from source or Subversion:
1. Download Grails binary Zip or Tar/Gz or checkout from Subversion with this command:
svn co http://svn.codehaus.org/grails/trunk/grails/
2. Set the JAVA_HOME environment variable.
3. Set the GRAILS_HOME environment variable to your Grails extract or checkout folder.
4. Add the “%GRAILS_HOME%bin” directory to your PATH environment variable.
5. Add the “%GRAILS_HOME%antbin” directory to your PATH environment variable.
6. Run chmod +x in “%GRAILS_HOME%antbin”.
7. Go to the %GRAILS_HOME% directory and type “ant” to build Grails.
8. Wait until it finishes compiling, and you are ready to use Grails.
Note: To update the Subversion folder, you can use this command: svn up, and every update you need to recompile Grails again (refer to step 7).
Next article: Groovy and Grails Part 2 – Create a Web Application
