Definitive Guide to Grails Sample Code Install

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"greg@udon.org", "url"=>""} on May 22, 2011 · 2 mins read

I've been reading the Definitive Guide to Grails by Graeme Rocher and Jeff Brown. After reading Beginning Groovy and Grails a couple of years ago, DGG is much more comprehensive and is answering a number of questions I had about Grails.

While there is a zip file with the some sample code at the apress site, the complete sample code can be found at https://github.com/grails-samples/dgg.

To copy all of the sample code for the book on your ubuntu system, you'll need to install git on your ubuntu system if you haven't already done that. You can also find a good description of using git with Grails here.

$ sudo apt-get install git-core
$ git config --global user.name "YOUR NAME"
$ git config --global user.email "YOUR EMAIL"
$ git config --list

I then created a directory in my Dropbox folder to hold the DGG sample code. A subdirectory called dgg will be created here. Change to this directory and execute the command:

$ git clone https://github.com/grails-samples/dgg.git

You'll find a README.TXT file in the root directory with more information on running the samples.

To create the user and database used by the sample code, execute these commands:

$ mysql -u root -p
mysql> CREATE USER 'gtunes' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'gtunes' WITH GRANT OPTION;
mysql> CREATE DATABASE gtunes_ch05;
mysql> quit

Old Site

These are the previous instructions used in this post.

To copy all of the sample code for the book on your ubuntu system, you'll need to install Subversion (SVN) on your ubuntu system if you haven't already done that.

$ sudo apt-get install subversion

I then created a directory in my Dropbox folder to hold the DGG sample code. A subdirectory called dgg will be created here. Change to this directory and execute the command:

$ svn checkout http://svn.codehaus.org/grails/trunk/grails-samples/dgg/