Ubuntu配置Ruby和Rails

时间:2024-01-03 12:02:08

安装curl

sudo apt-get install curl

安装RVM

curl -L https://get.rvm.io | bash -s stable

通过RVM来安装Ruby

rvm install 2.1.1

列举gem源

gem source -l

删除gem源

gem source -r https://rubygems.org/

添加gem源

gem source -a https://ruby.taobao.org

通过gem安装Rails

gem install rails

检查Rails版本

rails -v

Rails中的execjs安装nodejs为javascript runtime

sudo apt-get install nodejs

Ruby PG gem安装,需要生成Native Extension

sudo apt-get install libpq-dev
sudo find / -name pg_config
gem install pg -- --with-pg-config=/usr/bin/pg_config