Install ruby 1.9.3-p125 from source

来源:互联网 发布:单片机电路图仿真 编辑:程序博客网 时间:2024/06/04 20:06


On ubuntu server 10.04 you might want to avoid rvm and rbenv and just go straight for installing ruby on your server.

Install openssl development libraries and prerequisites.

sudo apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev

Install yaml

#!/bin/bash cd /usr/srcsudo wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gzsudo tar xvzf yaml-0.1.4.tar.gzcd yaml-0.1.4sudo ./configure --prefix=/usr/localsudo make sudo make install

Install ruby

#!/bin/bash cd /usr/srcsudo wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gzsudo tar xvzf ruby-1.9.3-p125.tar.gzcd ruby-1.9.3-p125sudo ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usrsudo makesudo make install

Install rubygems

  !#/bin/bash   cd /usr/src   sudo wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.17.tgz  sudo tar xvzf rubygems-1.8.17.tgz  cd rubygems-1.8.17  sudo ruby setup.rb

This is applicable if you want to run a certain version of ruby globally on your production server. If there is alreadt a version of ruby installed, check /usr/bin/ruby, /usr/bin/gem and /usr/bin/bundle and update the links accordingly.

eg.

  sudo rm /usr/bin/ruby; sudo ln -s /usr/local/bin/ruby /usr/bin/ruby  sudo rm /usr/bin/gem; sudo ln -s /usr/local/bin/gem /usr/bin/gem  sudo gem install bundler --pre  sudo rm /usr/bin/bundle; sudo ln -s /usr/local/bin/bundle /usr/bin/bundle

Happy compiling!

原文地址 :http://scoop.simplyexcited.co.uk/2012/03/02/install-ruby-1-9-3-p125-from-source/
原创粉丝点击