要安装ruby,首先要安装rvm,借助rvm安装ruby
?
rvm 的全称是 Ruby Version Manager ,是一款由 Wayne E. Seguin? 开发的一款命令行工具。rvm 能够让你轻松的安装、管理 ruby 生产力环境,诸如不同版本的解释器和 gem 。
?
打开终端,输入命令
?
curl -L get.rvm.io | bash -s stable
?
?然后
?
echo "source ~/.bashrc" >> ~/.bash_profile echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc source ~/.bashrcrvm -v//查看rvm版本
?
安装rvm成功后,就可以安装ruby了。
?
运行
?
rvm install 2.2.0
?
耐心等待ruby-2.2.0安装完成,但是有时,安装时会出现一些问题:
?
比如 ? ubuntu14.04系统,运行rvm install 2.2.0出现错误:
?
问题主要原因是 ?Ruby Rvm apt-get update 错误
?
错误代码:
Error running 'requirements_debian_update_system ruby-2.2.0',showing last 15 lines of /home/hww/.rvm/log/1411546866_ruby-2.2.0/update_system.log++ case "${TERM:-dumb}" in++ case "$1" in++ [[ -t 2 ]]++ return 1++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.For 404 errors check your sources configured in: /etc/apt/sources.list /etc/apt/sources.list.d/*.list\n'There has been error while updating 'apt-get', please give it some time and try again later.For 404 errors check your sources configured in: /etc/apt/sources.list /etc/apt/sources.list.d/*.list ++ return 100Requirements installation failed with status: 100.?
解决方案
?
在运行 rvm install 2.2.0 之前先运行
?
rvm autolibs disable?
然后再运行
?
rvm install 2.2.0?
问题应该能得到解决