Ubuntu Install Rbenv & Ruby & Rails (Week I)

Advanced Software Engineering

The First Class

Part I

1 Install Essential Dependecies

  1. sudo apt-get update
  2. 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-dev

2 Install Rbenv Environment

  1. git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  2. echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  3. echo 'eval "$(rbenv init -)"' >> ~/.bashrc
  4. source ~/.bashrc
  5. type rbenv
  6. git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

3 Install Ruby Environment

      List all version of ruby, and then you can chose one to install

  1. rbenv install -l
  2. rbenv install 1.9.3-p448

4 Set up Ruby Version and Change Gem Source

  1. rbenv global 1.9.3-p448  # accroding to the former one
  2. rbenv rehash
  3. gem sources --remove https://rubygems.org/
  4. gem sources -a http://ruby.taobao.org/

5 Install Rails

  1. gem install bundler rails

6 Check the Version

  1. ruby -v
  2. gem -v
  3. rake -V
  4. rails –v

      image

7 Install node.js

  1. sudo add-apt-repository ppa:chris-lea/node.js
  2. sudo apt-get update
  3. sudo apt-get install nodejs

8 Test the Environment

  1. cd ~
  2. mkdir rails
  3. cd rails
  4. rails new blog
  5. image
  6. cd blog
  7. rails server
  8. image
  9. http://127.0.0.1:3000
  10. image

9 Complete

原文地址:https://www.cnblogs.com/moonseazj/p/4821018.html