[Ruby on Rails series] 2. Development Environment preparation: Ruby on Rails Development Environment Configuration

Source: Internet
Author: User
Tags ruby on rails

Past Review

Last time I talked about the installation configuration of vmwarevm and the installation of scientific Linux 6. x system. This time, our main task is to complete the configuration of the Ruby on Rails development environment on the Linux operating system.

Before configuring the environment, you must first explain scientific Linux 6.x. this Linux release is similar to the management mechanism of centos and Red Hat Linux. If you use the above system in Linux, the configuration process is basically the same; if you use the Ubuntu system, the configuration process may be slightly different.

So, start! [Log on to the system as an administrator and complete installation. After installation, log on to the system as a common user]

 

Step 1: Install Ruby

[1] enter the official website (https://www.ruby-lang.org/zh_cn/ uninstall rubyinstallation source code ruby-2.1.2.tar.gz


[2] Open the/root/downloads folder, find the downloaded file, and copy it to the/usr/lib/Ruby folder (there is no ruby folder under usr/lib, create a ruby folder)


Unzip 3rd extract ruby-2.1.2.tar.gz: Open the terminal input in the/usr/lib/Ruby folder.

tar xvzf ruby-2.1.2.tar.gz

[4] enter the ruby-2.1.2 Folder: Enter

cd ruby-2.1.2


[5] install dependencies (very important) if an error occurs in subsequent gem or rails installation, it is likely that this step is not performed.

Enter at the terminal:

yum -y install gcc gcc-c++
yum –y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel


[6] input at the terminal

./configure

[7] enter at the terminal

make

[8] input on the terminal

make install

[9] After Ruby is installed, enter

ruby --version

Test whether the installation is successful


 

Step 2: Install gem, git, and rails

[1] install gem

1) input at the terminal

gem --version

View the gem version


2) input at the terminal

gem update --system

3) input at the terminal

gem update

If no problem exists, the gem update is successfully completed. If any problem occurs, it may be that step 1 does not properly install the dependency. I have encountered such a problem in Ubuntu (one is the dependency problem of zlib and the other is the dependency problem of OpenSSL. Finally, refer to the article solved by this great God [http://www.aichengxu.com/view/34894]

[2] install git

Install git in scientific Linux using yum. The procedure is as follows:

yum -y install gitgit --version

[3] installing rails

Enter the following directly on the terminal:

gem install rails

Wait until the installation is complete.

 

Step 3: install and configure the Java environment

[1] why install the Java environment?

Now, Ruby on Rails has been installed. But why install the Java environment? Because we need to use the integrated development environment of Aptana to develop the ROR program, and Aptana needs the support of JRE, We need to configure the Java environment.

[2] Download JDK "http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html? Sssourcesiteid = otncn]

Please note that you need to download the rpm version for this release


[3] install Java

In the downdolds folder [folder where the RPM package is located, usually/root/downloads], open the terminal and enter

rpm -ivh jdk-8u20-linux-i586.rpm

The supervisor automatically installs JDK.


[4] Test Java

Since the RPM package is used for installation, Linux automatically creates a soft link between Java and javac in usr/bin, even if no environment variable is configured, you can use Java as usual (feel the charm of the Linux File System !)


 

Step 4: install and configure the Aptana integrated development environment

[1] download the Aptana Development Environment

Http://www.aptana.com/products/studio3


[2] copy the downloaded installation file from the/root/downloads folder to the/OPT folder.

[3] decompress Aptana in the OPT folder


[4] on the basis of the Java environment, you can click aptanastudio3 to run it directly ~


[5] write a program to test


Now, the development environment of Ruby on Rails has been configured. In the integrated development environment of Aptana, you can switch to the terminal interface and enter IRB to enter the ruby interaction environment ~

After the environment is configured, you can switch back to a non-root account for development!

 

In addition, if you need to install rspec, you only need to enter: Gem install rspec on the terminal ~ If you are prompted that the permission is insufficient, proceed with the root account.

 

Postscript: Notes

1. This article is applicable to Red Hat Linux, centos, fedora, and scientific Linux. If you are a Ubuntu system, you need to make corresponding modifications.

2. Be sure to install the dependency package before installation. I did not install the two dependency packages under Ubuntu, which caused me to study the dependency problem for one afternoon, especially the OpenSSL dependency problem, for details, see the above link.

3. You need to install the Java environment before installing Aptana. If you are not using the RPM installation method, please remember to set the environment variables. You can set the environment variables on your own.

4. Perform the installation environment with the root permission. It is recommended that you do not perform development under the root account.

 

Next article: Ruby on Rails Series 3, coming soon ~

[Ruby on Rails series] 2. Development Environment preparation: Ruby on Rails Development Environment Configuration

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.