TShopping

 找回密碼
 註冊
搜索
查看: 3946|回復: 7
打印 上一主題 下一主題

[CentOS] 在 CentOS 5 安裝 Ruby On Rails

[複製鏈接]
跳轉到指定樓層
1#
發表於 2008-5-30 17:48:08 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
 
Push to Facebook
取自: http://faq.serverdiy.org/read.php?tid=71

CentOS 5 安裝 ROR

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 出現下面一堆東西,按 y 一直裝完就是了
[root@vmcentos5 ~]# yum install rubyworks
安裝好 RubyWorks ,他會把 ruby,rubygems,Mongrel,Haproxy,Monit 安裝跟設定好。但是他不會安裝 Rails ,而是 copy 一份 Rails 在 /usr/rails 上面,這其實是很正確的作法,因為他一開始就取向 Production Server,而 Production Server 本來就該將 Rails 版本 Freeze 在 Rails Doc 裡面。

[root@vmcentos5 ~]# gem i rails -y
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository
[root@vmcentos5 ~]#

先不管,再往下安裝

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

要在 CentOS 安裝 Rails Gem,那就

gem i rails -y 即可。

gem install mysql -- --with-mysql-include=/usr/include/mysql/mysql --with-mysql-lib=/usr/lib/mysql/
最後那個步驟,會出現
[root@vmcentos5 ~]# gem install mysql -- --with-mysql-include=/usr/include/mysql/mysql --with-mysql-lib=/usr/lib/mysql/Select which gem to install for your platform (i386-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation

就選 3 最新的


至於為何這樣,我也不太清楚。能動就好了。

 

臉書網友討論
2#
發表於 2011-9-25 00:53:58 | 只看該作者
看看.........  

版主招募中

3#
發表於 2012-5-16 00:41:58 | 只看該作者
樓主,支持!  


4#
發表於 2012-5-16 00:47:29 | 只看該作者
愛不了  


5#
發表於 2012-7-14 00:43:22 | 只看該作者
哈哈,頂你了哦.  


6#
發表於 2012-9-1 00:51:56 | 只看該作者
我來看看!謝謝  


7#
發表於 2012-9-1 01:01:46 | 只看該作者
初來乍到,請多多關照。。。  


8#
發表於 2012-9-27 18:14:10 | 只看該作者
真不错,赞一个,继续努力啊


*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-4-26 13:50 , Processed in 0.086659 second(s), 18 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表