Ubuntu builds Ruby on Rails environment

Source: Internet
Author: User
Tags ruby on rails

Install Ruby

Since the ruby version of the APT Package Manager in Ubuntu is too old, consider compiling the installation from the source code. Here is an example of installing ruby2.3.0:

sudo Install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-/tmpwget HTTPS://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gztar -xvzf ruby-2.3 . 0. Tar . GZ CD ruby-2.3.0/. /Configuremakesudomakeinstall

After the installation is complete, we can view its version:

$ ruby-2.3. 0p0 (-53290) [I686-linux]
Installing Sqlite3
sudo Install sqlite3 Libsqlite3-dev
Installing Rails

Due to GFW, Ruby's default gem source rubygems.org is inaccessible, so you need to change the source first.

To view the current gem Source:

$ gem Sources-L* * * * Current SOURCES * * *https://rubygems.org/

Change Source:

$ gem sources-r https://rubygems.org/https://rubygems.org/removed from sources$ Gem sources-a https://ruby.taobao.org/https://ruby.taobao.org/added to sources $ gem Sources-L* * * * Current SOURCES * * *https://ruby.taobao.org/

Installing rails:

sudo Install Rails

When the installation is complete, view its version:

$ rails--4.2. 5.2
Modify Gemfile

Edit Gemfile:

sudo VI /usr/local/lib/ruby/gems/2.3. 0/gems/railties-4.2. 5.2/lib/rails/generators/rails/app/templates/gemfile

The first line

' https://rubygems.org '

Switch

' https://ruby.taobao.org/ '
Installing the JavaScript runtime

Here you choose to install Nodejs:

sudo Install Nodejs
Build Rails Engineering
Rails New Demo

Go to the folder and start the server:

CD demo/Rails server

Ubuntu builds Ruby on Rails environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.