Configure the Ruby on Rails environment in CentOS

Source: Internet
Author: User

Detailed installation steps:

I. Update Python
Python 2.4 is installed by default in centos. Because the new version of rails requires support for nodejs, you need to update python.
Copy codeThe Code is as follows:
Yum install-y bzip2 * # nodejs 0.8.5 is required. install this module before installing python.

Wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Tar zvxf Python-2.7.3.tgz
Cd Python-2.7.3
./Configure
Make & make install
/Usr/local/bin/python2.7-V # view Python version
Establish a soft connection to point python to python2.7 by default.
Under normal circumstances, even if python2.7 is successfully installed, the python version to which the system points is still 2.4.3 by default. Considering that yum is based on python2.4.3, it can work normally and cannot be uninstalled easily.
Copy codeThe Code is as follows:
Mv/usr/bin/python. bak
Ln-s // usr/local/bin/python2.6/usr/bin/python
Python-V # verify if python points to a success
After the system python soft link points to python 2.6, yum cannot work normally.
Copy codeThe Code is as follows: $ vi/usr/bin/yum
Change #/usr/bin/python displayed in text editing to #/usr/bin/python2.4 and save the modification.

Ii. Install related dependent packages
# Yum install gcc-c ++ openssl * readline * ncurses * zlib * libxml * libjpeg * libpng * libxslt * libtool *
3. Install NodeJS
Copy codeThe Code is as follows:
Wget http://nodejs.org/dist/v0.8.5/node-v0.8.5.tar.gz
Tar zvxf node-v0.8.5.tar.gz
Cd node-v0.8.5
./Configure
Make & make install
File. We recommend that you install YAML first. Otherwise, a gem installation exception may occur.
Copy codeThe Code is as follows:
Wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
Tar xzvf yaml-0.1.4.tar.gz
Cd yaml-0.1.4
./Configure -- prefix =/usr/local
Make
Make install

5. Install Ruby 1.9.3
Copy codeThe Code is as follows: wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
Tar xzvf ruby-1.9.3-p0.tar.gz
Cd ruby-1.9.3-p0
./Configure -- prefix =/usr/local -- enable-shared -- disable-install-doc -- with-opt-dir =/usr/local/lib
Make
Make install
6. Upgrade gem and install Rails
If gem installation fails, you can download the source code to install it.
Copy codeThe Code is as follows: wget http://rubyforge.org/frs/download.php/74445/rubygems-1.6.2.tgz
Tar zxvf rubygems-1.6.2.tgz
Cd rubygems-1.6.2
Ruby setup. rb
If gem is successfully installed, execute the next step.
Copy codeThe Code is as follows:
Gem update -- system
Gem install rdoc
Gem install rails
Rails-v

 

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.