Wednesday, October 28, 2009

ruby on rails installation on ubuntu 9.04

for god's sake, i have this serious problem with ruby on rails installation on ubuntu 9.04, i tried so many times with all possible ways to install and without exception it always failed! tried to loggin to their IRC to ask for help and got blamed by some arrogarant people saying that i was not good at following instruction! damn maybe i have problem with following instruction, but if RoR is stupid enough that only by following instruction step by step, why bother to use it anyway? however that's another story, let me focus on installing it first, all in all i still wanna try ruby on rails.

this time with help from others and the instruction from ruby on rails community:

1. install ruby:
sudo apt-get install ruby-full build-essential

2. install rubygems
sudo apt-get install rubygems1.8
sudo gem install rubygems-update

3. install rails:
sudo apt-get install rails 

4. install MySQL:
sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql

5. install apache:
sudo gem install passenger
sudo apt-get install apache2-threaded-dev libapr1-dev libaprutil1-dev
sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module
then add the following to the apache configuration file:
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby1.8
 
6. setup virtual host: 
sudo emacs /etc/apache2/apache2.conf
add the following:
NameVirtualHost *:80
create file for ror.myhost.com:
susdo emacs /etc/apache2/sites-available/ror.myhost.com
and add the following:

ServerName ror.myhost.com
DocumentRoot /home/dan/Public/mynewapp/public
sudo emacs /etc/hosts
and add:
127.0.0.1  ror.myhost.com
then restart apache2:
sudo a2enmod rewrite
sudo a2ensite ror.myhost.com
sudo /etc/init.d/apache2 restart

7. bring up firefox browser, point it to http://ror.myhost.com/, hola, it works! display ror welcom aboard page.

problem remains:
1. when restart apache2: it complains:
 * Restarting web server apache2                                          
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:12 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Oct 28 16:05:13 2009] [warn] NameVirtualHost *:80 has no VirtualHosts
                                                                         [ OK ]

2. it's sth complaining about xmlsimple module, when create a new project using rails, it shows:
/usr/lib/ruby/1.8/xmlsimple.rb:275: warning: already initialized constant KNOWN_OPTIONS
/usr/lib/ruby/1.8/xmlsimple.rb:280: warning: already initialized constant DEF_KEY_ATTRIBUTES
/usr/lib/ruby/1.8/xmlsimple.rb:281: warning: already initialized constant DEF_ROOT_NAME
/usr/lib/ruby/1.8/xmlsimple.rb:282: warning: already initialized constant DEF_CONTENT_KEY
/usr/lib/ruby/1.8/xmlsimple.rb:283: warning: already initialized constant DEF_XML_DECLARATION
/usr/lib/ruby/1.8/xmlsimple.rb:284: warning: already initialized constant DEF_ANONYMOUS_TAG
/usr/lib/ruby/1.8/xmlsimple.rb:285: warning: already initialized constant DEF_FORCE_ARRAY
/usr/lib/ruby/1.8/xmlsimple.rb:286: warning: already initialized constant DEF_INDENTATION
/usr/lib/ruby/1.8/xmlsimple.rb:287: warning: already initialized constant DEF_KEY_TO_SYMBOL

-- To fix this one, reinstall rubygems and rails:

wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.5.tgz
tar xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb
Once it's done you can remove the .tgz file and erase the rubygems-1.3.4 directory too.then reinstall rubygems:
sudo gem install rails

No comments: