1.安装rbenv环境
$ sudo apt-get install zlib1g-dev openssl libopenssl-ruby1.9.1 libssl-dev libruby1.9.1 libreadline-dev git-core
$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL
$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git
$ rbenv install 1.9.3-p194
#You will have to rehash everytime you install a Ruby version or a gem
$ rbenv rehash
$rbenv global 1.9.3-p194
$ irb
参考自:http://www.stehem.net/2012/05/08/how-to-install-ruby-with-rbenv-on-ubuntu-12-04.html
里面出现安装包的错误:解决方法如下
2.1 Setup rbenv
2.2 Make sure you have a plugins directory:
mkdir ~/.rbenv/plugins
2.3 Clone rbenv-sudo into the plugins directory:
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo
reference:https://github.com/dcarley/rbenv-sudo
3 usage:
$ rbenv sudo chef-solo --version
Chef: 0.10.8
$ rbenv sudo ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ rbenv sudo ruby -e "puts Process.uid"
0