日期:2014-05-16  浏览次数:20544 次

linux下rvm安装ruby以及rubygems的过程分享

以前从来没有使用过ruby,这两天刚好要使用GitHub上的离线wiki系统gollum,所以要在偶的ubuntu下安装ruby和ruby-gems。其中遇到一些问题:


如果使用apt-get install ruby 和apt-get install rubygems1.8

当使用gem install 命令时报以下错误:


ERROR: While executing gem ... (TypeError)?instance of Date needs to have method `marshal_load

?

可能是Ubuntu环境的原因,那么就改用rvm安装,参考了http://beginrescueend.com/rvm/install/?

若以非root模式安装:


bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )


?添加rvm scripts路径变量到bash:


? ?? echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

???

?让新的bash生效:


? ? ?source ~/.bash_profile

?

安装ruby1.9.2:

? ??rvm install 1.9.2

??

让系统默认使用1.92:

? ??rvm use 1.9.2 --default



检查安装是否OK:

? ? ruby ?-v

--------------------------------------------

接下来安装rubygems

先到官网下载安装包http://rubygems.org/pages/download


然后安装

ruby setup.rb