Installing Grails in Ubuntu GNU/Linux Using Package Manager
In my previous post I talked about setting up Grails development environment in GNU/Linux distributions by manually downloading the packages and configuring the environment variables. The main advantage of this method is that you can work with the latest versions of the Groovy and Grails packages available, and in fact, you can work with more than one version of these software at the same time: just point your environment variables to different locations. The procedure is also more or less independent of a particular GNU/Linux distribution.
An easier, alternative way to install Groovy and Grails packages is to use the package management system of your favourite GNU/Linux distribution. The trade-off is that you have to accept the version of the packages that are available in your distribution’s repositories(apt-get) or you may have to compromise with the stability of your system(dpkg). Below I am documenting the procedure to install Grails development environment using package manager tools in Ubuntu 8.04(Hardy Heron).
-
Installing Sun JDK 6 in Ubuntu 8.04 Using apt-get/aptitude
In Debian/Ubuntu based operating systems installing new packages is as simple as running aptitude command with the package name.
# sudo aptitude install sun-java6-jdkYou also need to set JAVA_HOME environment variable in your preferred profile file(/etc/profile, $HOME/.profile or /etc/environment):
JAVA_HOME=/usr/lib/jvm/java-6-sun
Refer to the first step of previous post in my Grails series if you need more help.
-
-
Installing Groovy in Ubuntu 8.04 Using apt-get/aptitude
To install Groovy and its dependency packages, run the following command in a command shell:
# sudo aptitude install groovyYou can also install Groovy from Synaptic Package Manager, simply search for package name called “groovy” in it. But have a look at the version number!
See what I mean? The latest stable version of Groovy is 1.5.6 though I would recommend using the 1.6 beta 1.
-
Installing Groovy in Ubuntu 8.04 Using GDebi
If you don’t mind picking up a deb file from a third-party source, Groovy download page has Debian/Ubuntu packages for both 1.5.6 stable version and 1.6 beta 1 version.
When you download the Ubuntu deb binary from this page Ubuntu will automatically open it using GDebi and install it for you.
-
Installing Groovy in Ubuntu 8.04 Using dpkg
You can also save the deb file on your computer and install it from the command shell using the dpkg tool:
# sudo dpkg -i <name-of-the-downloaded-deb-file>
-
-
-
Installing Grails in Ubuntu 8.04 Using apt-get/aptitude
Unfortunately there is no Grails package in Ubuntu official repositories yet. You can try any unofficial repositories for Grails available on the Internet but only if you trust them. An old repository meant for installing Grails 1.0 RC2 on Ubuntu Gutsy was posted on Ubuntu Forums by prach. Have a look at it just as an example, I don’t recommend actually using it. I don’t know of a similar repository for more recent versions of Grails. So better option will be to install the latest deb package of Grails using GDebi or dpkg tools; see the next step.
-
Installing Grails in Ubuntu 8.04 Using GDebi
You can follow the above procedure(Step 2(b)) used for Groovy to install Grails too, by downloading its deb package from Grails’s download page.
Then choose to open the package with GDebi installer.
-
Installing Grails in Ubuntu 8.04 Using dpkg
You can also save the deb file on your computer and install it from the command shell using the dpkg tool:
# sudo dpkg -i <name-of-the-downloaded-deb-file>
-
- You can now go to the post where I show how to create a basic “Hello, World” Grails application to test your Grails configuration. (You can ignore the first step of that post.)
Summary:
To summarize, you can install Sun JDK, Groovy and Grails packages in Debian/Ubuntu family of distributions using simple commands, like this:
# sudo echo ‘JAVA_HOME=/usr/lib/jvm/java-6-sun’ >> /etc/profile
# wget http://dist.codehaus.org/groovy/distributions/installers/deb/groovy-1.6-beta-1.deb
# sudo dpkg -i groovy-1.6-beta-1.deb
# wget http://ant-deb-task.googlecode.com/files/grails_1.0.3-1_all.deb
# sudo dpkg -i grails_1.0.3-1_all.deb
You can use similar commands/tools for other GNU/Linux distributions, like yum in Fedora, yast in openSUSE, emerge in Gentoo, etc. All the above download links point to the latest versions at the time of this writing, so remember to change them appropriately when updated versions are released.


















