1. Prepare the library used for installation
$ Sudo apt-Get install GCC g ++ build-essential libssl-dev libreadline5-dev zlib1g-dev Linux-headers-generic
2. Download ruby1.9.2 source code compilation and Installation
$ Wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
(If you cannot download, you can choose: http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.tar.bz2, http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.zip)
$ Tar-xvzf ruby-1.9.2-p0.tar.gz
$ CD ruby-1.9.2-p0/
$./Configure-Prefix =/usr/local/Ruby
$ Make & sudo make install
3. Prepare Environment Variables
$ Sudo gedit/etc/environment
Add Environment Variables
Path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/Ruby/bin"
Make environment variable effective
$ Source/etc/environment
4. Check Ruby Installation
$ Ruby-V
5. Create Association
$ Sudo ln-S/usr/local/Ruby/bin/Ruby/usr/local/bin/Ruby
$ Sudo ln-S/usr/local/Ruby/bin/gem/usr/bin/gem
6. Install rails
$ Sudo gem install tzinfo builder memcache-client rack-test erubis mail text-format bundler Thor i18n
$ Sudo gem install rack-mount
$ Sudo gem install rails
7. Check the rails Installation
$ Source/etc/environment
$ Rails-V
8. If you use a MySQL database
$ Sudo apt-Get install mysql-server libmysqlclient-dev libmysql-Ruby
$ Sudo gem install MySQL
If you use an SQLite Database
$ Sudo apt-Get install libsqlite3-dev build-essential
$ Sudo gem install sqlite3-ruby
9. If you want to install the spree framework
$ Sudo gem install spree
10. Create an application for testing
For MySQL
$ Rails new XXX-D = MySQL
$ CD xxx
Configure MySQL and open the config/database. yml file:
Development:
Adapter: mysql2
Encoding: utf8
Database: blog_development
Pool: 5
Username: Root
Password:
Socket:/tmp/MySQL. Sock
Configure your username and password.
To use the spree framework, edit gemfile and add a gem 'spree'
$ Bundle install
$ Rake DB: Create
$ Rails server or $ rails s
Open http: // localhost: 3000 in the browser.
Environment configuration is complete.