ubuntu安裝ruby on rails 環境

1,首先要換成阿里的源。而且gem apt-get update更新下源
mysql

2,安裝依賴包:git

  1. sudo apt-get install -y build-essential openssl curl libcurl3-dev libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev libsqlite3-devgithub

 3,安裝rbenvsql

cdruby

git clone git://github.com/sstephenson/rbenv.git .rbenvbash

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrccurl

echo 'eval "$(rbenv init -)"' >> ~/.bashrcui

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-buildurl

echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrcspa

exec $SHELL

 4,安裝ruby


rbenv install 2.2.2

rbenv global 2.2.2

rbenv rehash

5,換成淘寶源安裝rails。

  gem sources --remove https://rubygems.org/

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

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

gem install rails -V 

rbenv rehash # 導出 gem 中提供的系統命令

6,查看rails版本

rails -v

7,安裝mysql

sudo apt-get install mysql-server  mysql-client  libmysqlclient-dev

相關文章
相關標籤/搜索