您的位置:首页 > 运维架构 > Linux

Ruby install on RHEL 5.5 Linux 64

2011-05-13 17:06 351 查看
Link: https://github.com/imeyer/ruby-1.9.2-rpm
The following instructions assume installation on a 32-bit platform. For 64-bit replace i386 with x86_64 .

yum install -y rpm-build

cd /usr/src/redhat/SOURCES

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
cd /usr/src/redhat/SPECS

curl https://github.com/robduncan/ruby-1.9.2-rpm/raw/master/ruby19.spec > ruby19.spec

rpmbuild -bb ruby19.spec

rpm -Uvh ../RPMS/i386/ruby-1.9.2p180-1.ruby-1.9.2p180-1.i386.rpm

x86_64:

cd /usr/src/redhat/SOURCES

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
cd /usr/src/redhat/SPECS

rpmbuild -bb ruby19.spec

[root@svltest358 SPECS]# rpmbuild -bb ruby19.spec

error: Failed build dependencies:

readline-devel is needed by ruby-1.9.2p180-1.x86_64

ncurses-devel is needed by ruby-1.9.2p180-1.x86_64

gdbm-devel is needed by ruby-1.9.2p180-1.x86_64

glibc-devel is needed by ruby-1.9.2p180-1.x86_64

tcl-devel is needed by ruby-1.9.2p180-1.x86_64

gcc is needed by ruby-1.9.2p180-1.x86_64

openssl-devel is needed by ruby-1.9.2p180-1.x86_64

db4-devel is needed by ruby-1.9.2p180-1.x86_64

byacc is needed by ruby-1.9.2p180-1.x86_64

那么换老办法了,自己手动编译吧:

1.

[root@svltest358 ruby-1.9.2-p180]# ./configure -prefix=/usr/local/ruby

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/data/software/ruby-1.9.2-p180':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details

安装gcc吧,解决问题:

yum -y install gcc

2.

make

make install

3.

export PATH=/usr/local/ruby-1.8.7-p330/bin:$PATH

把这个放到 ./.bash_profile里面比较好

4.

安装

[root@svltest358 ~]# gem install JSON

ERROR: Loading command: install (LoadError)

no such file to load -- zlib

ERROR: While executing gem ... (NameError)

uninitialized constant Gem::Commands::InstallCommand

zlib的包没有安装好,重装安装ruby 源码中的zlib可以解决这个问题,

# yum install zlib zlib-devel

Then:

# cd /usr/local/src/ruby-1.9.2-p38/ext/zlib/

# ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib

# make

# make install

其实json已经是ruby的扩展库了,不用单独安装的。 Good!

5.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: