| SoftOver |
| Home Humor Puzzles Links Ruby News bLogs Books |
|
Installing Ruby and RubyGems on 1and1 Shared Host (Linux)
Ruby
When I decided to open a Ruby section, I thought that it would be a good idea to have all examples powered by Ruby itself. In the middle of creation of PHP wrappers I've found that a) ruby version provided by 1and1 is 1.8.1 (pretty old), and b) gems are not installed. Googling for possible solutions brought useful blog entries by Ed Johnson, Pascal and James Stewart (as I am not interested in Rails for now, I do not have Ed's problems). After several attempts and playing with different configuration settings I finally succeeded - and all future Ruby posts will be powered by Ruby! And, as one of my favorite programming principles - The Pragmatic Programmers' DRY (Don't Repeat Yourself) - naturally evolves to DAO TRAY (Don't Ask Others To Repeat After You), I've captured the sequence of commands in a shell script. If you have a shared 1and1 (or any other provider) linux host with ssh access, you can just download and run the script: wget http://softover.com/files/ruby_install.sh ruby_install.sh If you don't like downloading scripts, you can re-type all commands yourself: pushd ~ mkdir bin cd bin mkdir ruby cd ruby # Get and install ruby wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6.tar.gz tar -zxvf ruby-1.8.6.tar.gz cd ruby-1.8.6 #### get patch for ossl.h #### please see notes below wget http://softover.com/files/ossl.patch patch ext/openssl/ossl.h ossl.patch #### end patch ./configure prefix=~/bin/ruby make make install echo 'export PATH=~/bin/ruby/bin:$PATH' >> ~/.bash_profile export PATH=~/bin/ruby/bin:$PATH cd .. # Get and install gems wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz tar -zxvf rubygems-0.9.4.tgz cd rubygems-0.9.4 echo 'export GEM_HOME=~/bin/ruby' >> ~/.bash_profile export GEM_HOME=~/bin/ruby ruby setup.rb config --prefix=~/bin/ruby ruby setup.rb setup ruby setup.rb install popd Some of you can see patching on the same level of danger as running scripts. Instead of patching you can fix a bug in ossl.h yourself: /* * OpenSSL has defined RFILE and Ruby has defined RFILE - so undef it! */ #if defined(RFILE) /*&& !defined(OSSL_DEBUG)*/ # undef RFILE #endif #include <ruby.h> #include <rubyio.h> Cut it and paste right after the last include line #include <openssl/conf_api.h> Coming next: Running Ruby from PHP |