linxu ubuntu 12.04 下搭建rvm

来源:互联网 发布:在哪设置淘宝宝贝分类 编辑:程序博客网 时间:2024/06/07 04:04

1. 安装RVM

mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone git://github.com/wayneeseguin/rvm.git && cd rvm && ./install

 

2. 安装相关软件

执行

rvm requirements

按要求安装相关必需的软件。

 

 

3.安装ruby 和rails

rvm install 1.8.7rvm listrvm 1.8.7rvm 1.8.7 --defaultrvm systemgem install rails 

 

4.问题解决

4.1 RVM is not a function, selecting rubies with 'rvm use ...' will not work.

原因是确实环境变量

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profileecho '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrcPATH=$PATH:$HOME/.rvm/binsource .bash_profile

4.2 启动rails server的过程中提示No JavaScripts Run time

有两个解决方法

1) 在Gemfile中添加

gem 'execjs' gem 'therubyracer'

 

然后执行(第一条不可忽略)

bundle install therubyracer bundle install 

2)安装nodejs

sudo apt-cache search nodejs
 

4.3 customer_require.rb:36 `gem_original_require`: no such file to load --openssl

确实openssl

按下列步骤安装ruby

rvm pkg install openssl
rvm pkg install iconv
rvm remove 1.8.7
rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr
0 0