Ubuntu Install Rbenv & Ruby & Rails (Week I)
Advanced Software Engineering
The First Class
Part I
1 Install Essential Dependecies
- sudo apt-get update
- 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
- git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
- echo 'eval "$(rbenv init -)"' >> ~/.bashrc
- source ~/.bashrc
- type rbenv
- 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
- rbenv install -l
- rbenv install 1.9.3-p448
4 Set up Ruby Version and Change Gem Source
- rbenv global 1.9.3-p448 # accroding to the former one
- rbenv rehash
- gem sources --remove https://rubygems.org/
- gem sources -a http://ruby.taobao.org/
5 Install Rails
- gem install bundler rails
6 Check the Version
- ruby -v
- gem -v
- rake -V
- rails –v
7 Install node.js
- sudo add-apt-repository ppa:chris-lea/node.js
- sudo apt-get update
- sudo apt-get install nodejs
8 Test the Environment
- cd ~
- mkdir rails
- cd rails
- rails new blog
- cd blog
- rails server
- http://127.0.0.1:3000
9 Complete