” Installing Ruby on Rails on Ubuntu 10.04″

Posted by Piyush Gupta on July 21, 2010

There are a few different approaches to installing Ruby on Rails on Ubuntu 10.4. This is the technique that I use, in my opinion it involves the least hassle.

Ubuntu has a managed ruby package that serves perfectly as the basis for a Ruby on Rails installation. Open a console and install it with the following command.

sudo apt-get install ruby-full build-essential

I’ve previously had issues with the rubygems Debian package and would normally advocate installing the package directly from RubyForge.

cd ~
mkdir gems
cd gems
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar -xf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo ruby setup.rb

The ruby setup script doesn’t automatically place a link to the gems application in your /usr/bin folder so add it now.

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Update your ruby environment. If you’ve downloaded the latest version of rubygems, you’ll be told that everything is already up-to-date.

sudo gem update system
gem -v

With your ruby environment ready, install rails.

sudo gem install rails

You’re finally at the point where you can create rails projects, just use the following command.

rails test_project

I prefer to use something a bit more friendly than vi as a development environment for Rails. Download and install the latest copy of Netbeans from netbeans.org.

wget http://download.netbeans.org/netbeans/6.9/final/bundles/netbeans-6.9-ml-linux.sh
chmod +x netbeans-6.9-ml-linux.sh
./netbeans-6.9-ml-linux.sh

“Ruby On Rails environment on Ubuntu 10.04

Posted by Piyush Gupta on June 22, 2010

I think this is my first technical post in the blog, so today I faced some problems while building the Ruby on Rails environment on my machine. I just like sharing this knowledge with you.

First, in this post we will make the following:

1. Ruby 1.9.1
2. Rails 2.3.5
3. Thin server.
4. MySQL server.

1. Ruby 1.9.1
The following commands mainly download the Ruby source code and compile it and so on

Just you have to install the following libraries:

sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

move to /usr/local/src to download source code and compile it in this folder
cd /usr/local/src

Download the source code, and unpack it

sudo wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz
sudo tar xzf ruby-1.9.1-p0.tar.gz
cd ruby-1.9.1-p0

Now, you have to check the version of gcc if it is 4.4 some errors will occur

dpkg -l | grep gcc

if gcc 4.4 found then you have to edit the cont.c file to go on. Open it up, and change the lines 90, 270 and 317 from #elif to #else.

sudo gedit cont.c

then write the following commands in terminal

sudo ./configure –prefix=/usr/local/ruby-1.9.1
sudo make
sudo make install

After these steps you have finally installed Ruby 1.9.1, to check its version

cd /usr/local/ruby-1.9.1/bin
ruby -v
output like that: ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

Now, the ruby commands such as ruby, rake, irb, … etc are accessed only from /usr/local/ruby-1.9.1/bin, and all the commands are found in /usr/local/bin so just make link for the commands in ruby-1.9.1/bin and put them in /usr/local/bin

sudo ln -s /usr/local/ruby-1.9.1/bin/ruby /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/rake /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/gem /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/irb /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/ri /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/rdoc /usr/local/bin

2. Rails 2.3.5
Now, Ruby 1.9.1 is installed successfully on your machine, just add this command to terminal to install the Rails 2.3.5 gem

sudo gem install rails -v=2.3.5

3. Thin server
Also to install Thin application server gem

sudo gem install thin

4. MySQL server
Finally to install MySQL server for DB

sudo apt-get install mysql-server
and while installing it is required to set the root password

References: http://www.bunchedin.com/8Bolx6

Hope that it is some how useful for you

Install Sphinx Search on Ubuntu (Almost All) 10

Posted by Piyush Gupta on April 13, 2010

If you’ve graduated from using Ferret you may have heard of the joys of Sphinx Search. Regardless of which plugin you use (there are several) you’ll need to install Sphinx itself. If you’re running Ubuntu Intrepid Ibex then these instructions are for you. That said, this will work on Debian or Ubuntu Hardy as well.

1. Update and Grab dependencies. Run these commands in order to get the files you need to install Sphinx.

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install build-essential
sudo apt-get install libmysqlclient15-dev

2. Download Sphinx. You can download the latest code from their website.

3.Untar the source and prep. Here’s where it gets a bit complicated. You’ll need to extract the source, change into the directory and configure Sphinx. Do that with these commands.

tar xvzf sphinx-0.9.8.1.tar.gz<br />cd sphinx-0.9.8.1/<br />./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql<br />

4. Make and Install Sphinx Run the standard linux commands to install Sphinx.

make<br />sudo make install<br />

That’s it! Now you can grab your plugins and start up the server.

Technorati Tags: , , , , , , , ,