compile ruby 1.9.3 along with required gems to make it as like package bundle

112 views Asked by At

We don't have ruby 1.9.3 rpm for CentOS 5.x and am looking to compile this ruby version from source. Am able to compile it using below steps,

cd /usr/src wget http://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=/usr/local/ruby193 --disable-install-doc --with-opt-dir=/usr/local/lib make && make install

And then I will simply zip the ruby193 and distribute to all of my servers. But am looking the way to compile along with required additional gems and so that after I bundle it and when am installing do not need to install any additional gems.

So I can just simply copy the zip file and extract it on all the servers which should work without installing any additional installation requirement. By this way I can maky unique version of ruby on all of my which are running with CentOS 5, CentOS 6 and SunOS. But not sure if this works on CentOS 4 as well , am still using this OS version for few servers due to some application requirements.

Update:

Finally am able to make this working with the below way,

  • compiled ruby
  • installed necessary gems
  • make it as tar gz file

Copied to another servers and it works fine. But only issue am facing with libyaml,

[root@server-test bin]# ruby --version
ruby 1.9.3p551 (2014-11-13) [x86_64-linux]
[root@server-test bin]# gem list
/usr/local/dops/tools/ruby193/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

*** LOCAL GEMS ***

bigdecimal (1.1.0)
ffi (1.9.18)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)
rubygems-update (2.6.11)

I compiled yaml from source before compile ruby but not sure why am still getting this error when I copy to another servers. But it works fine on the server where I compiled.

Any idea please..

Update 2:

After more debugging found that the library libyaml-0.so.2 doesn't exists.

LoadError: libyaml-0.so.2: cannot open shared object file: No such file or directory

I can't compile yaml on all the servers then it will manually again. If I just copy the file libyaml-0.so.2 from working server to new one under /lib and run ldconfig will it work?

1

There are 1 answers

0
Karthi1234 On BEST ANSWER

Finally I compiled from source and created as tar package. I had to compile yaml from source and include the lib folder to make it work.