Ubuntu 10.10 Server: From Clean install to Grails for all users
I’m playing around with Grails at the moment. Grails is a make-websites-really-fast framework, that is based on the Groovy language. It’s inspired in spirit by Ruby-on-Rails, but it’s based on solid java technology instead.
In my opinion, this the best framework for java developers to switch to. Learning curve for a java developer is a lot easier than ruby/python/scala/clojure etc. and the groovy language is very powerful and easy. Ont eh other hand… it doesn’t teach you how to think differently, and you may be tempted to keep your bad java habits. Anyway, I’m getting derailed. What I really wanted to show you today was how to get grails working on a linux server.
I’ll assume that this is a totally clean install of Ubuntu 10.10 server, I used the 32-bit version, but I think the 64-bit installation will be identical. The first thing we do is to install ssh, so we can log in with putty ( http://www.putty.org/ ) afterwards. Then we upgrade the system, then we reboot.
sudo aptitude install ssh
sudo aptitude update
sudo aptitude upgrade
sudo reboot
Login with putty when the reboot is done. Then install the C++ compiler and the linux headers. It may not be needed, but I tend to do it anyway, as they cover a lot of weird dependencies when installing various development tools. We also install sun’s java (as the openjdk fails to run grails) and groovy (yay, it’s a std package).
sudo aptitude install build-essential linux-headers-$(uname -r)
In order to install sun’s jdk we need to enable some more repositories. Start by running
sudo nano /etc/apt/sources.list
Then uncomment the lines for the partner repos and save the file. Partner repos look like this:
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu maverick partner
Update apt with:
sudo aptitude update
Once that is done we can install the sun jdk and groovy
sudo aptitude install sun-java6-jdk
sudo aptitude install groovy unzip
After that we fetch the grails binary, unpack and move it.
wget http://dist.codehaus.org/grails/grails-1.3.5.zip
unzip grails-*.zip
mv grails-1.3.5 grails
sudo rm -r /usr/lib/grails
sudo mv grails /usr/lib/grails
Then we need to edit the environment file, so we can access the JAVA_HOME and GRAILS_HOME. We also add the Grails bin directory to the path. Run these commands:
sudo cp /etc/environment /etc/environment_backup
sudo sed -i 's/\(^PATH=".*\)"/\1:\/usr\/lib\/grails\/bin"\nJAVA_HOME=\/usr\/lib\/jvm\/java-6-sun\nGRAILS_HOME=\/usr\/lib\/grails\n/g' /etc/environment
After the commands, you can verify ( cat /etc/environment ) that the environment file should look a lot like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/grails/bin"
JAVA_HOME=/usr/lib/jvm/java-6-sun
GRAILS_HOME=/usr/lib/grails
Once that’s done we need to reboot the system, in order to read the new environment:
sudo reboot
Log in again and test by calling:
grails help
It should show you the version of grails and the help info. To test it for another user, create a user ( sudo adduser <username>) , log in as that user and run “grails help”. If it does that correctly, then this guide worked
[...] learned how to set up setup grails and how to install hudson on Ubuntu 10.10 Server. Now I want to use hudson to build my grails [...]
Building a grails project in hudson « makeitfaster
December 14, 2010 at 16:40