Installing Grails with Netbeans on ubuntu under VirtualBox

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"", "url"=>""} on May 01, 2011 · 4 mins read

Here are the steps I used on an Windows 7 system to install the above. I'm using ubuntu 11.04, VirtualBox 4.0.4 and Netbeans 7.0 Java SE edition.

- Install VirtualBox Guest Additions.


- Install git using the command:

$ sudo apt-get install git-core
$ git config --global "YOUR NAME"
$ git config --global "YOUR EMAIL"
$ git config --list


- Install JDK using the commands:

$ sudo add-apt-repository ppa:sun-java-community-team/sun-java6
$ sudo apt-get update
$ sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk

With ubuntu 11.04 I had to execute these commands:

$ sudo add-apt-repository ppa:ferramroberto/java
$ sudo apt-get update
$ sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk

- Set the JAVA_HOME environment variables in your .profile or .bashrc file.

$ dpkg --get-selections sun*
$ dpkg -L sun-java6-bin | grep bin/java
$ JAVA_HOME=/usr/lib/jvm/java-6-sun-
$ export JAVA_HOME


Download the Groovy & Grails documentation and unzip in /usr/share/doc. Optionally, install Groovy.

$ sudo apt-get install groovy

Install grails using the ubuntu package manager:

$ sudo add-apt-repository ppa:groovy-dev/grails
$ sudo apt-get update
$ sudo apt-get install grails
$ cd /usr/lib/grails/grails-1.3.7
$ ./gradlew libs
$ ./gradlew install

The gradlew libs command failed with an error associated with accessing the cache. After numerous attempts to address this issue, I gave up on the package manager based install of grails and am switching to the download install.

$ sudo apt-get remove grails
$ sudo mkdir -p /usr/share/doc/grails/doc
$ cd /usr/share/docs/grails/doc
$ sudo unzip /tmp/
$ cd /usr/lib
$ sudo mkdir grails
$ cd grails
$ sudo unzip /tmp/

Set the environment variables in /etc/profile and your .bashrc file.


Test your install by entering the grails command and you should see results similar to this.

$ grails
Welcome to Grails 1.3.7 -
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/lib/grails/grails-1.3.7

To complete the test of your install try this:

$ grails create-app test
$ cd test
$ grails run-app
Running Grails application..
Server running. Browse to http://localhost:8080/test


Go to the NetBeans download page and download the Java SE edition. We'll add Grails support later to save disk space and for better runtime performance.

$ cd Downloads
$ chmod +x
$ ./

Add the netbeans bin directory to your path and then run netbeans.

$ PATH=$PATH:~/netbeans-7.0/bin
$ netbeans

From the main screen, click on the My NetBeans tab and then select the Install Plugins option. Scroll through the list of plugins and choose the Groovy and Grails plugin. Click Install and follow the prompts.

After re-starting NetBeans, select File > New Project, then select Groovy > Grails Application. Pick and name for your project and click Configure Grails.


Thanks to Dean Del Ponte for his blog on grails: getting started in netbeans 6.7 and to the Installation post and to ganu for his ubuntu grails install post.

As a newbie to the ubuntu/Debian package manager, thanks to Matthew Danish for his APT and DPKG Quick Reference.

To list all installed packages: dpkg --get-selections
To list the files that are in a specific package: dpkg -L To list info about a specific package: dpkg -s

Using Git with Grails -