Thinking in XiaoQiang
posts - 56,comments - 150,trackbacks - 0


This is a small guide I wrote up to installing Ruby on Rails on Dapper Drake. It covers getting lighttpd running to support both rails and php which will be useful to anyone who likes to use phpmyadmin along with ruby on rails. It's similar to the article I wrote earlier for Arch Linux except modified for Ubuntu's Dapper Drake release.

1. Make sure the universe repository in /etc/apt/sources.list is uncommented:
deb dapper universe
deb-src dapper universe

2. Make sure you are up to date:
sudo apt-get update
sudo apt-get dist-upgrade

3. Install the ruby base packages:
sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby

4. We need to grab the latest ruby gems from rubyforge. You may need to modify this command if a version after 0.90 is available.
sudo wget
tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
sudo ruby setup.rb

5. Now let's install Ruby on Rails!
sudo gem install rails --include-dependencies

6. We have Rails but we still need lighttpd and mysql. I've thrown in PHP too in case you want to manage your database with phpmyadmin like I do. Let's grab all the packages, shall we?
sudo apt-get install lighttpd php5-cgi php4-cgi php5-mysql php5-mysqli php4-mysql libfcgi-dev libfcgi-ruby1.8

7. Modify your /etc/lighttpd/lighttpd.conf file to set up your domains. Be careful because by default Ubuntu maps all the images so that they are taken from /usr/share/images instead of your/rails/root/public/images so if you're wondering why your rails app is working but your images aren't being displayed this is why. You can take out the offending code in your lighttpd.conf or just put your images in /usr/share/images.

8. Time to enable some modules for lighttpd. There are others that you may need but they should be enabled in your lighttpd.conf. Personally, I'm not a fan of enabling modules two different ways but I'm sure this will get cleaned up eventually.
sudo /usr/sbin/lighty-enable-mod fastcgi
sudo /usr/sbin/lighty-enable-mod proxy
sudo /etc/init.d/lighttpd force-reload

9. Let's make sure that there are no errors by stopping lighttpd and then starting it manually:
sudo /etc/init.d/lighttpd stop
sudo lighttpd -f /etc/lighttpd/lighttpd.conf

If you have errors there make sure you take a look and try to address them! The output you see will be your best bet in getting help from somebody on one of the forums.

10. Install some basic gems you might need to run your rails app:
sudo gem install actionmailer
sudo gem install activesupport
sudo gem install actionpack
sudo gem install actionwebservice

And now you should have a new, shiny, ready to go Ubuntu Dapper Drake server just waiting for your PHP or Ruby on Rails applications!
posted on 2006-10-30 17:07 小强 阅读(377) 评论(0)  编辑  收藏 所属分类: ruby