Linux下安装ruby

来源:互联网 发布:淘宝客导购位线下推广 编辑:程序博客网 时间:2024/05/01 17:08


第一步:
$wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar zxf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4/
$ ./configure --prefix=/home/root/ruby
$ make
$ make install
第二步:
$wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
$ tar zxf ruby-1.9.3-p0.tar.gz
$cd ruby-1.9.3-p0
$ ./configure--prefix=/home/root/ruby --with-opt-dir=/home/root/ruby
$ vim ext/Setup # open themodules you want 
$ vim Makefile
CFLAGS =  ${cflags}-I/home/root/ruby/include # the location where yaml.h fileexist
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir)-I/home/root/ruby/include # the location where yaml.h fileexist

$ make
$ make install

第三步:

rubygems安装  (略)


ps:

$ bin/gem -v
/home/root/ruby/lib/ruby/1.9.1/yaml.rb:56:in`<top (required)>':
It seems your ruby installation is missing psych (for YAMLoutput).
To eliminate this warning, please install libyaml andreinstall your ruby.
1.8.11
出现此提示说明第一步未安装