`

CentOS 5 安裝 ROR

阅读更多
Updated 2012/7/30
if you are using ubuntu 12, try
sudo aptitude install libmysqlclient-dev



1. 安裝 RubyWorks

安裝 RubyWorks Repo
wget [url=http://rubyworks.rubyforge.org/public_key.txt]http://rubyworks.rubyforge.org/public_key.txt[/url]
sudo rpm --import public_key.txt
wget [url=http://rubyworks.rubyforge.org/RubyWorks.repo]http://rubyworks.rubyforge.org/RubyWorks.repo[/url]
cp RubyWorks.repo /etc/yum.repos.d/

用 yum 安裝 RubyWorks

yum install rubyworks 出現下面一堆東西,按 y 一直裝完就是了
--------------------------------------------------------------------------------------------------------


[root@vmcentos5 ~]# yum install rubyworks
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
rubyworks           100% |=========================| 951 B   00:00   
base               100% |=========================| 1.1 kB   00:00   
updates             100% |=========================| 951 B   00:00   
addons             100% |=========================| 951 B   00:00   
extras             100% |=========================| 1.1 kB   00:00   
Reading repository metadata in from local files
primary.xml.gz         100% |=========================| 2.2 kB   00:00   
rubyworks : ################################################## 6/6
Added 6 new packages, deleted 0 old in 0.05 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for rubyworks to pack into transaction set.
rubyworks-0.0.1-1.i386.rp 100% |=========================| 4.7 kB   00:00   
---> Package rubyworks.i386 0:0.0.1-1 set to be updated
--> Running transaction check
--> Processing Dependency: monit >= 4.9 for package: rubyworks
--> Processing Dependency: ruby >= 1.8.5 for package: rubyworks
--> Processing Dependency: ruby-devel >= 1.8.5 for package: rubyworks
--> Processing Dependency: rubygems >= 0.9.2 for package: rubyworks
--> Processing Dependency: haproxy >= 1.2.17 for package: rubyworks
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for rubygems to pack into transaction set.
rubygems-0.9.2-1.i386.rpm 100% |=========================| 7.7 kB   00:00   
---> Package rubygems.i386 0:0.9.2-1 set to be updated
---> Downloading header for ruby to pack into transaction set.
ruby-1.8.5-5.el5.i386.rpm 100% |=========================| 35 kB   00:00   
---> Package ruby.i386 0:1.8.5-5.el5 set to be updated
---> Downloading header for haproxy to pack into transaction set.
haproxy-1.2.17-1.i386.rpm 100% |=========================| 4.4 kB   00:00   
---> Package haproxy.i386 0:1.2.17-1 set to be updated
---> Downloading header for ruby-devel to pack into transaction set.
ruby-devel-1.8.5-5.el5.i3 100% |=========================| 22 kB   00:00   
---> Package ruby-devel.i386 0:1.8.5-5.el5 set to be updated
---> Downloading header for monit to pack into transaction set.
monit-4.9-1.i386.rpm     100% |=========================| 4.2 kB   00:00   
---> Package monit.i386 0:4.9-1 set to be updated
--> Running transaction check
--> Processing Dependency: ruby-libs = 1.8.5-5.el5 for package: ruby-devel
--> Processing Dependency: gcc for package: rubygems
--> Processing Dependency: flex for package: monit
--> Processing Dependency: ruby-libs = 1.8.5-5.el5 for package: ruby
--> Processing Dependency: libcrypto.so.4 for package: monit
--> Processing Dependency: libruby.so.1.8 for package: ruby
--> Processing Dependency: libssl.so.4 for package: monit
--> Processing Dependency: libruby.so.1.8 for package: ruby-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for ruby-libs to pack into transaction set.
ruby-libs-1.8.5-5.el5.i38 100% |=========================| 74 kB   00:00   
---> Package ruby-libs.i386 0:1.8.5-5.el5 set to be updated
---> Downloading header for gcc to pack into transaction set.
gcc-4.1.1-52.el5.2.i386.r 100% |=========================| 59 kB   00:00   
---> Package gcc.i386 0:4.1.1-52.el5.2 set to be updated
---> Downloading header for openssl097a to pack into transaction set.
openssl097a-0.9.7a-9.i386 100% |=========================| 22 kB   00:00   
---> Package openssl097a.i386 0:0.9.7a-9 set to be updated
---> Downloading header for flex to pack into transaction set.
flex-2.5.4a-41.fc6.i386.r 100% |=========================| 8.3 kB   00:00   
---> Package flex.i386 0:2.5.4a-41.fc6 set to be updated
--> Running transaction check
--> Processing Dependency: libgcc >= 4.1.1-52.el5.2 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Processing Dependency: libgomp.so.1 for package: gcc
--> Processing Dependency: libgomp = 4.1.1-52.el5.2 for package: gcc
--> Processing Dependency: cpp = 4.1.1-52.el5.2 for package: gcc
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for glibc-devel to pack into transaction set.
glibc-devel-2.5-12.i386.r 100% |=========================| 105 kB   00:00   
---> Package glibc-devel.i386 0:2.5-12 set to be updated
---> Downloading header for libgcc to pack into transaction set.
libgcc-4.1.1-52.el5.2.i38 100% |=========================| 49 kB   00:00   
---> Package libgcc.i386 0:4.1.1-52.el5.2 set to be updated
---> Downloading header for cpp to pack into transaction set.
cpp-4.1.1-52.el5.2.i386.r 100% |=========================| 52 kB   00:00   
---> Package cpp.i386 0:4.1.1-52.el5.2 set to be updated
---> Downloading header for libgomp to pack into transaction set.
libgomp-4.1.1-52.el5.2.i3 100% |=========================| 49 kB   00:00   
---> Package libgomp.i386 0:4.1.1-52.el5.2 set to be updated
--> Running transaction check
--> Processing Dependency: glibc-headers for package: glibc-devel
--> Processing Dependency: glibc-headers = 2.5-12 for package: glibc-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for glibc-headers to pack into transaction set.
glibc-headers-2.5-12.i386 100% |=========================| 138 kB   00:00   
---> Package glibc-headers.i386 0:2.5-12 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package           Arch     Version       Repository     Size 
=============================================================================
Installing:
rubyworks           i386     0.0.1-1       rubyworks       19 k
Installing for dependencies:
flex             i386     2.5.4a-41.fc6   base         124 k
gcc               i386     4.1.1-52.el5.2   updates       4.9 M
glibc-devel         i386     2.5-12       base         2.0 M
glibc-headers       i386     2.5-12       base         605 k
haproxy           i386     1.2.17-1       rubyworks       162 k
libgomp           i386     4.1.1-52.el5.2   updates         69 k
monit             i386     4.9-1         rubyworks       209 k
openssl097a         i386     0.9.7a-9       base         825 k
ruby             i386     1.8.5-5.el5     base         278 k
ruby-devel         i386     1.8.5-5.el5     base         554 k
ruby-libs           i386     1.8.5-5.el5     base         1.6 M
rubygems           i386     0.9.2-1       rubyworks       127 k
Updating for dependencies:
cpp               i386     4.1.1-52.el5.2   updates       2.6 M
libgcc             i386     4.1.1-52.el5.2   updates         82 k

Transaction Summary
=============================================================================
Install   13 Package(s)       
Update     2 Package(s)       
Remove     0 Package(s)       

Total download size: 14 M
Is this ok [y/N]: y
Downloading Packages:
(1/15): ruby-libs-1.8.5-5 100% |=========================| 1.6 MB   00:09   
(2/15): glibc-headers-2.5 100% |=========================| 605 kB   00:03   
(3/15): rubygems-0.9.2-1. 100% |=========================| 127 kB   00:02   
(4/15): gcc-4.1.1-52.el5. 100% |=========================| 4.9 MB   00:27   
(5/15): ruby-1.8.5-5.el5. 100% |=========================| 278 kB   00:01   
(6/15): glibc-devel-2.5-1 100% |=========================| 2.0 MB   00:11   
(7/15): openssl097a-0.9.7 100% |=========================| 825 kB   00:04   
(8/15): libgcc-4.1.1-52.e 100% |=========================| 82 kB   00:00   
(9/15): flex-2.5.4a-41.fc 100% |=========================| 124 kB   00:00   
(10/15): cpp-4.1.1-52.el5 100% |=========================| 2.6 MB   00:06   
(11/15): haproxy-1.2.17-1 100% |=========================| 162 kB   00:01   
(12/15): libgomp-4.1.1-52 100% |=========================| 69 kB   00:00   
(13/15): ruby-devel-1.8.5 100% |=========================| 554 kB   00:01   
(14/15): rubyworks-0.0.1- 100% |=========================| 19 kB   00:00   
(15/15): monit-4.9-1.i386 100% |=========================| 209 kB   00:01   
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ruby-libs             ####################### [ 1/17] 
Installing: ruby                 ####################### [ 2/17] 
Installing: ruby-devel             ####################### [ 3/17] 
Installing: libgomp               ####################### [ 4/17] 
Installing: haproxy               ####################### [ 5/17] 
Updating : cpp                 ####################### [ 6/17] 
Installing: flex                 ####################### [ 7/17] 
Updating : libgcc               ####################### [ 8/17] 
Installing: openssl097a             ####################### [ 9/17] 
Installing: monit                 ####################### [10/17] 
Installing: glibc-headers           ####################### [11/17] 
Installing: glibc-devel             ####################### [12/17] 
Installing: gcc                 ####################### [13/17] 
Installing: rubygems               ####################### [14/17] 
Installing: rubyworks             ####################### [15/17] 
--20:38:03-- http://rubyworks.rubyforge.org/gems.tgz
Resolving rubyworks.rubyforge.org... 205.234.109.18
Connecting to rubyworks.rubyforge.org|205.234.109.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 332051 (324K) [application/x-gzip]
Saving to: `/tmp/gems.tgz'

100%[=======================================>] 332,051     156K/s   in 2.1s   

20:38:06 (156 KB/s) - `/tmp/gems.tgz' saved [332051/332051]

Successfully installed rake, version 0.7.3
Successfully installed daemons, version 1.0.6
Building native extensions. This could take a while...
Successfully installed fastthread, version 1.0
Successfully installed gem_plugin, version 0.2.2
Successfully installed cgi_multipart_eof_fix, version 2.1
Building native extensions. This could take a while...
Successfully installed mongrel, version 1.0.1
Installing a skeleton Rails application into /usr/rails
wget http://rubyworks.rubyforge.org/rails_skeleton.tgz -O /tmp/rails_skeleton.tgz
/tmp/install_skeleton_app.rb:8: warning: Insecure world writable dir /usr, mode 040777
--20:38:12-- http://rubyworks.rubyforge.org/rails_skeleton.tgz
Resolving rubyworks.rubyforge.org... 205.234.109.18
Connecting to rubyworks.rubyforge.org|205.234.109.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1597654 (1.5M) [application/x-gzip]
Saving to: `/tmp/rails_skeleton.tgz'

100%[=======================================>] 1,597,654   377K/s   in 5.2s   

20:38:18 (297 KB/s) - `/tmp/rails_skeleton.tgz' saved [1597654/1597654]

tar -zxf /tmp/rails_skeleton.tgz -C /usr
find /usr/rails -exec chown rails {} \;
find /usr/rails -exec chgrp rails {} \;
Starting Process Monitor (monit): Starting monit daemon with http interface at [127.0.0.1:2812]
[ OK ]
Cleanup   : libgcc               ####################### [16/17]
Cleanup   : cpp                 ####################### [17/17]

Installed: rubyworks.i386 0:0.0.1-1
Dependency Installed: flex.i386 0:2.5.4a-41.fc6 gcc.i386 0:4.1.1-52.el5.2 glibc-devel.i386 0:2.5-12 glibc-headers.i386 0:2.5-12 haproxy.i386 0:1.2.17-1 libgomp.i386 0:4.1.1-52.el5.2 monit.i386 0:4.9-1 openssl097a.i386 0:0.9.7a-9 ruby.i386 0:1.8.5-5.el5 ruby-devel.i386 0:1.8.5-5.el5 ruby-libs.i386 0:1.8.5-5.el5 rubygems.i386 0:0.9.2-1
Dependency Updated: cpp.i386 0:4.1.1-52.el5.2 libgcc.i386 0:4.1.1-52.el5.2
Complete!
You have mail in /var/spool/mail/root
[root@vmcentos5 ~]# 
---------------------------------------------------------------------------------------------------------
安裝好 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: [url=http://gems.rubyforge.org/]http://gems.rubyforge.org[/url]
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 最新的


至於為何這樣,我也不太清楚。能動就好了。
以上是節錄自 http://lightyror.thegiive.net/2007/06/centos-ruby-on-rails.html 有些紅色的是我改過的
分享到:
评论

相关推荐

    centos7.0安装mysql

    centos7.0安装mysql centos7.0安装mysql centos7.0安装mysql

    CentOS 8 安装图解

    5. 准备安装 CentOS 8 在准备安装 CentOS 8 的过程中,需要配置以下内容: * 键盘布局 * 日期和时间 * 安装来源 * 软件选择 * Kdump 在软件选择选项中,可以选择安装的模式,例如“包含图形界面Server with GUI”...

    centos 7.6安装流程.docx

    Centos 7.6 安装流程详解 在这篇文章中,我们将详细介绍 Centos 7.6 的安装流程,从虚拟机的创建到 Centos 7.6 的安装,再到 Secure CRT 与虚拟机的连接。 虚拟机的创建 在安装 Centos 7.6 之前,我们需要创建一...

    centos5.8安装教程

    知识点 5: 安装 CentOS 5.8 安装 CentOS 5.8 的过程与直接用光盘安装基本一致。用户需要选择正确的分区方案,并注意操作系统的 grub 默认写入 U 盘的问题。 知识点 6:解决 grub 写入 U 盘的问题 在选择分区时,...

    CentOS5安装LAMP(最小化安装)

    linux- CentOS5安装LAMP(最小化安装)

    CentOS7安装指南

    5. 安装详情界面。 6. 设置时区,点击“Date & TIME”。 7. 设置分区硬盘分区,这边由于是虚拟机,故一个分区足矣。 8. 设置软件安装模式,这里选择“Development and Creative Workstation”。 9. 设置完毕后,点击...

    CentOS 7 安装 MySQL

    CentOS 7 安装 MySQL

    centos6.7安装jdk

    ### CentOS 6.7 安装 JDK 1.8 的详细步骤 在 CentOS 6.7 上安装 JDK 1.8 是一项常见的任务,对于运行 Java 应用程序至关重要。以下是从连接到服务器到验证安装的整个过程: #### 1. 连接到 CentOS 服务器 首先,...

    Centos离线安装zip和unzip

    一些情况下, 服务器不联网, 则安装一些常用的命令比较麻烦, 本资源提供 Centos 离线安装 zip 和 unzip 命令和安装方法, 文件包含 unzip-6.0-21.el7.x86_64.rpm 和 zip-3.0-11.el7.x86_64.rpm以及安装命令。

    Centos7.9安装部署Zabbix6

    Centos7.9安装部署Zabbix6,需要安装包的发邮箱,文件里面包含邮箱地址

    centos 6 安装 mantisbt-1.2.8 -- centos 7 安装 mantisbt-2.12.0.zip

    内容: 1、centos 6 安装 mantisbt-1.2.8 ; 2、 centos 7 安装 mantisbt-2.12.0.zip 3、mantisbt-2.12.0.tar.gz包; 4、MySQL-5.5.59-1.el7.x86_64.rpm-bundle.tar包

    Centos5.5下Qt的安装配置

    CentOS 5.5 下 Qt 的安装配置 在 CentOS 5.5 平台下安装 Qt 需要经过多个步骤,每个步骤都需要注意一些重要细节。本文将详细讲解 CentOS 5.5 下 Qt 的安装配置过程。 一、安装软件列表 在开始安装 Qt 之前,需要...

    centos7安装mysql5.7

    在本地虚拟机的场合,需要更换yum安装网络地址配置文件CentOS-Base.repo 从阿里云服务器下载一份CentOS-Base.repo文件存到本地

    VirtualBox安装CentOS5

    VirtualBox 安装 CentOS 5 VirtualBox 是一款功能强大且免费的虚拟机软件,允许用户在单个物理机器上运行多个操作系统。以下是使用 VirtualBox 安装 CentOS 5 的详细步骤和知识点。 安装 CentOS 5 在开始安装 ...

    arm架构centos7安装docker

    安装步骤参考:https://blog.csdn.net/chkai123/article/details/126229727 docker离线安装 arm架构下离线安装docker docker centos7离线安装docekr 离线安装docker arm架构下安装docker arm架构centos7安装docker

    【PDF】CentOS+6.4安装(超级详细图解教程)

    5、CentOS 6.4 的系统运行方式分为:带图形界面、可以用鼠标操作的图形化方式和不带图形界面、直接用命令行操作的文本方式(具体的系统运行方式,可以在系统安装的过程中自定义选择); 6、解决 VMware ...

    Centos7.9安装zabbix6.0LTS版

    CentOS 7.9 安装 Zabbix 6.0 LTS 版 Zabbix 是一个基于 Web 的网络监控系统,能够实时监控服务器、网络设备和应用程序的状态。下面是 CentOS 7.9 安装 Zabbix 6.0 LTS 版的详细步骤。 安装 Nginx 首先,需要安装 ...

    CentOS 5安装教程图文讲解

    CentOS 5安装教程图文讲解 比较详细,值得收藏

    CentOS 6安装教材

    CentOS是Linux发行版之一,相信不少朋友想知道CentOS系统安装配置的方法,下面小编给大家介绍下安装配置CentOS6.6的具体步骤,感兴趣的朋友不妨来了解下吧。

Global site tag (gtag.js) - Google Analytics