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.7
rvm list
rvm 1.8.7
rvm 1.8.7 --default
rvm system
gem 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_profile
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
PATH=$PATH:$HOME/.rvm/bin
source .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