6/04/2007

在 CentOS 安裝 Ruby on Rails

昨天在 CentOS 安裝 Ruby on Rails 的時候,我發現到雖然用 RubyWorks 來安裝很快,但是有些小細節還是得注意。所以還是寫一個 Tutorial 好了。



1. 安裝 RubyWorks

安裝 RubyWorks Repo
wget http://rubyworks.rubyforge.org/public_key.txt
sudo rpm --import public_key.txt
wget http://rubyworks.rubyforge.org/RubyWorks.repo
cp RubyWorks.repo /etc/yum.repos.d/
用 yum 安裝 RubyWorks
yum install rubyworks
安裝好 RubyWorks ,他會把 ruby,rubygems,Mongrel,Haproxy,Monit 安裝跟設定好。但是他不會安裝 Rails ,而是 copy 一份 Rails 在 /usr/rails 上面,這其實是很正確的作法,因為他一開始就取向 Production Server,而 Production Server 本來就該將 Rails 版本 Freeze 在 Rails Doc 裡面。但是如果還是要在 CentOS 安裝 Rails Gem,那就
gem i rails -y
即可。

2. 安裝 MySQL

RubyWorks 好歸好,就是沒有選擇讓我們裝 DB Server,我們這裡就直接用 yum 安裝 MySQL
yum install mysql-server

3. 安裝 Ruby MySQL Native Lib

我發現到 RubyWorks 並不會安裝 Ruby MySQL Native Lib,所以我們得用 gem 安裝,但是又發現 centos 上面安裝 MySQL Gem 會出現這樣的錯誤訊息,網路上也有人在 complian
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir

所以得先 remove MySQL 然後再重新安裝 MySQL 跟 MySQL Development Lib
yum remove mysql
yum install mysql
yum install mysql-devel
gem install mysql
至於為何這樣,我也不太清楚。反正 work 就好啦。

這樣應該就安裝完成了。

5 則留言:

匿名 提到...

可否請教您的 CentOS 是哪一個版本?

thegiive 提到...

CentOS 5

elleryq 提到...

"complian"應為"complain"

匿名 提到...

^ Thanks Captain Obvious!

匿名 提到...

Hey Blogger! Would like to pretend that I much like your blog site many.
[url=http://www.businesscreditcardv.com]business credit card[/url] [url=http://www.businesscreditcardv.com/apply-for-business-credit-card]apply for business credit card[/url] business credit card employee [url=http://www.calendartemplatev.com]calendar template[/url] [url=http://www.calendartemplatev.com/weekly-calendar-template]weekly calendar template[/url] calendar template windows [url=http://www.carbatteryv.com]car battery[/url] [url=http://www.carbatteryv.com/12-volt-car-battery]12 volt car battery[/url] car battery 90ah [url=http://www.digitalphotoframev.com]digital photo frame[/url] [url=http://www.digitalphotoframev.com/wireless-digital-photo-frame]wireless digital photo frame[/url] digital photo frame 3.5 review [url=http://www.fitnessgymv.com]fitness gym[/url] [url=http://www.fitnessgymv.com/the-best-fitness-gym]the best fitness gym[/url] fitness gym 90042 [url=http://www.greenhomev.com/]green home[/url] [url=http://www.greenhomev.com/green-homes-for-sale]green homes for sale[/url] excel fitness gym utah [url=http://www.hairremovalv.com]hair removal[/url] [url=http://www.hairremovalv.com/hair-removal-for-men]hair removal for men[/url] hair removal ultrasound [url=http://www.homemadepizzav.com]homemade pizza[/url] [url=http://www.homemadepizzav.com/homemade-pizza-toppings]homemade pizza toppings[/url] how to make homemade pizza easy [url=http://www.horsetrailersv.com]horse trailers[/url] [url=http://www.horsetrailersv.com/gooseneck-horse-trailers]gooseneck horse trailers[/url] horse trailers repair [url=http://www.hybridbikev.com]hybrid bike[/url] [url=http://www.hybridbikev.com/cheap-hybrid-bikes]cheap hybrid bikes[/url] hybrid bike tire pressure [url=http://www.itunesv.org]itunes[/url] [url=http://www.itunesv.org/itunes-help]itunes help[/url] itunes converter [url=http://www.kneepainv.com]knee pain[/url] [url=http://www.kneepainv.com/back-of-knee-pain]back of knee pain[/url] knee pain from kneeling [url=http://www.lavenderplantsv.com]lavender plants[/url] [url=http://www.lavenderplantsv.com/french-lavender-plants]french lavender plants[/url] lavender plants sequim [url=http://www.minimacv.com]mini mac[/url] [url=http://www.minimacv.com/memory-mini-mac]memory mini mac[/url] mini max 400 part 070951 [url=http://www.moneytreev.com]money treev[/url] [url=http://www.moneytreev.com/feng-shui-money-tree]feng shui money tree[/url] money tree everett wa [url=http://www.organicvegetablev.com]organic vegetable[/url] [url=http://www.organicvegetablev.com/organic-vegetable-seeds]organic vegetable seeds[/url] organic vegetable broth powder [url=http://www.paintballgunv.com]paintball gun[/url] [url=http://www.paintballgunv.com/military-paintball-guns]military paintball guns[/url] paintball gun ny [url=http://www.pontoonboatsv.com]pontoon boats[/url] [url=http://www.pontoonboatsv.com/sweetwater-pontoon-boats]sweetwater pontoon boats[/url] pontoon boats questions [url=http://www.projectmanagementv.com]project management[/url] [url=http://www.projectmanagementv.com/project-management-software]project management software[/url] project management kick off meeting [url=http://www.ps3gamesv.com]ps3 games[/url] [url=http://www.ps3gamesv.com/top-ps3-games-for-2010]top ps3 games for 2010[/url] ps3 games vs xbox games [url=http://www.thyroidproblemv.com]thyroid problem[/url] [url=http://www.thyroidproblemv.com/thyroid-problems-and-pregnancy]thyroid problems and pregnancy[/url] thyroid problems in newborns [url=http://www.turnkeywebsitev.com]turnkey website[/url] [url=http://www.turnkeywebsitev.com/free-turnkey-websites]free turnkey websites[/url] turnkey website magazine subscription business [url=http://www.vitamindv.com]vitamin d[/url] [url=http://www.vitamindv.com/liquid-vitamin-d]liquid vitamin d[/url] vitamin d low