-
Setting Up Ubuntu for Rails Development
These are a the procedures we use to setup a PC or VM for development of a ruby on rails application.
First things first, get your install software ready. These instructions are based on the Hardy Heron version of Ubuntu (8.04).
Install the base OS and then fire up the terminal so you can copy and paste the following commands.
So once you have the base installed, make sure your distribution is up to date:
sudo apt-get update sudo apt-get dist-upgradeNow install the package required for building software:
sudo apt-get install build-essentialNow we are going to install Ruby and Mysql:
sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.0 mysql-common mysql-server-5.0 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 psmiscNow download the latest rubygems, we like to build this so that we have the latest version since the package repositories for Ubuntu have an older version:
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgztar -xzvf rubygems-1.3.1.tgzsudo ruby setup.rbNow make sure the symbolic links are all set. If you have to type gem1.8 list (instead of just gem list) then the link is not working:
sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gemsudo ln -s /usr/bin/ruby1.8 /usr/local/bin/rubysudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdocsudo ln -s /usr/bin/ri1.8 /usr/local/bin/risudo ln -s /usr/bin/irb1.8 /usr/local/bin/irbNow install rails:
sudo gem install railsHaving setup the environment, you now need to install something to develop with. We like to use Netbeans for this (but we do NOT use Jruby).
Download the install script for the latest Netbeans. I usually just download this to the desktop, then run it without sudo since we want to make sure the local user has full control. Do NOT install it outside of the user’s home directory!
wget ftp://ftp.ussg.iu.edu/netbeans/6.5/bundles/netbeans-6.5-ml-ruby-linux.sh ./netbeans-5.6-ml-ruby-linux.shOnce installed, you need to configure netbeans to not use Jruby. Go into the Netbeans menu, under Tools and select RubyGems. Make sure you set the default gems to NOT use Jruby. If you wish, just remove Jruby from netbeans, then you do not need to worry about the wrong set of gems being used.
If you wish to install ImageMagick so you can use the Rmagick gem, do the following:
Remove old imagemagick package:
sudo apt-get remove imagemagickRemove old graphicsmagick:
sudo apt-get remove graphicsmagickInstall the build tools:
sudo apt-get install build-essentialInstall build dependencies for ImageMagick:
sudo apt-get build-dep imagemagickNow make sure you have everything else you will need:
sudo apt-get install libperl-dev libperl gcc libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-configDownload ImageMagick, extract it and switch to it:
sudo wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick-6.4.8-5.tar.gzsudo tar xvzf ImageMagick-6.4.8-5.tar.gzcd ImageMagick-6.4.8-5/ sudo ./configure --disable-openmp sudo makesudo make installTo confirm it all worked and see available formats, run the following:
identify -list formatWe had to execute and add the following to the .bashrc file in order to get it working after an error with the above:
export LD_LIBRARY_PATH=/usr/local/libNow to install the Mysql gem to improve Mysql performance. You need to get the proper headers to install the gem:
sudo apt-get install libmysqlclient-dev sudo gem install mysql --no-rdoc --no-riLeave a reply