Ubuntu system configuration Ruby On Rails development environment method

  

Using Ruby On Rails under Linux can make the maintenance and development of web applications more convenient, allowing developers to focus more on the logical structure of the system, before use Need to configure the Ruby On Rails development environment first, the following small series will introduce you how to configure Ruby On Rails development environment under Ubuntu 12.04.

Ubuntu 12.04 + Ruby 2.0 + Rails 3.2.13

1, the system needs to install the package

$ sudo apt-get install -y build-essential openssl Curl libcurl3-dev libreadline6 libreadline6-dev git zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev libsqlite3-dev libmysql-ruby libmysqlclient-dev

2, install RVM

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

After installing RVM successfully,

Then, load the RVM environment (newly open Termal will not do this, it will be automatically reloaded)

$ source ~/.rvm/scripts/rvm

Check if it is installed correctly

$ rvm -v

rvm 1.17.3 (stable) by Wayne E. Seguin [email protected]", Michal Papis "[email protected]" [https://rvm.io/]

3, Install Ruby Environment with RVM

# Replace Ruby Download Address Go to the domestic Taobao mirror server $ sed -i.bak ‘s! Ftp.ruby-lang.org/pub/ruby! Ruby.taobao.org/mirrors/ruby! ’ $rvm_path/config/db

# Install readline package $ rvm pkg install readline

# Install Ruby 2.0.0$ rvm install 2.0.0 --with-readline-dir=$ Rvm_path/usr

4, set the Ruby version

$ rvm 2.0.0 --default

Test is correct

$ ruby ​​-v

ruby ​​2.0.0p0 (2013-02-24 revision 39474)[x86_64-darwin12.3.0]

$ gem -v

2.0.0

$ gem Source -r https://rubygems.org/

$ gem source -a http://ruby.taobao.org

5, install Rails environment

$ gem Install bundler rails

Test if the installation is correct

$ bundle -v

Bundler version 1.0

$ rails -v

Rails 3.2 .13

6. Install MySQL

$ sudo apt-get install mysql-server mysql-client //Keep in mind the password you entered during installation $ sudo apt-get install libmysql-ruby libmysqlclient- Dev

$ gem install mysql2

View Gem package gem lis t

The above is how Ubuntu built the Ruby On Rails development environment. You need to install RVM, install the Ruby environment, install the Rails environment, and finally install MySQL.

Copyright © Windows knowledge All Rights Reserved