IT Staff

Blog về chuyên ngành IT

Install RoR on ubuntu 12.04

leave a comment »

■ Update
$sudo apt-get update

■ Install CURL
$ sudo apt-get install curl
–Setting up curl (7.22.0-3ubuntu4.8) …

■ Run curl for RVM package
$ curl -L get.rvm.io | bash -s stable

Installing RVM to /home/xavier/.rvm/
Adding rvm PATH line to /home/xavier/.profile /home/xavier/.bashrc /home/xavier/.zshrc.
Adding rvm loading line to /home/xavier/.bash_profile /home/xavier/.zlogin.
Installation of RVM in /home/xavier/.rvm/ is almost complete:

* To start using RVM you need to run `source /home/xavier/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.

# xavier,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: http://rvm.io/help and https://twitter.com/rvm_io

■ Add a line to ~/.bashrc
$ vi ~/.bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

■ And a couple of lines to ~/.bash_profile
$ vi ~/.bash_profile
[[ -s “$HOME/.profile” ]] && source “$HOME/.profile”
[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm”

■ Install the packages we need for Ruby to work:
$ source ~/.rvm/scripts/rvm
$ rvm requirements
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system………………..
Installing required packages: gawk, libreadline6-dev, libyaml-dev, libsqlite3-dev, sqlite3, libgdbm-dev, bison, libffi-dev……….
Requirements installation successful.

■ Ruby
① $ rvm install 2.1.2
Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-2.1.2.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.2 – #configure
ruby-2.1.2 – #download

② $ rvm use 2.1.2
Using /home/xavier/.rvm/gems/ruby-2.1.2

③ $ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

④ $ rvm –default use 2.1.2
Using /home/xavier/.rvm/gems/ruby-2.1.2

⑤ gem -v
2.2.0

■ Rails
(The “rubyonrails.org” recommend Ruby 2.1.0 for use with Rails)

$ gem install rails
27 gems installed

$ rails -v
Rails 4.1.4

 

$ gem install json -v ‘1.8.1’
1 gem installed

$ rails new /home/xavier/WORKSPACE/RoR/mysample

$ cd /home/xavier/WORKSPACE/RoR/mysample

$ rails server

 

■ Mysql2

$ sudo apt-get install libmysql-ruby libmysqlclient-dev

$ gem install mysql2

 

「Link Ref:

http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

http://railsapps.github.io/installrubyonrails-ubuntu.html

Written by Xavier

Tháng Bảy 11, 2014 lúc 3:23 sáng

Posted in Lap trinh, RoR, Ruby, Staff

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: