Install JDK, Ruby, node. JS, and other runtimes in Linux [from cainiao to expert drills]

Source: Internet
Author: User

Author: Egg

Email: xtfggef@gmail.com

Weibo: http://weibo.com/xtfggef

Blog: http://blog.csdn.net/zhangerqing (reprinted please explain the source)

We often work in Linux, so we must learn to install these commonly used runtimes. These jobs are all the same. Learn one kind of jobs. The other jobs will be okay!

Generally, there are three methods:

1. Use package manager like rvm of Ruby (recommended)

2. Directly install the Binary Package

3. Compile and install the source code package

The three methods are relatively simple. In addition to the installation steps, an important step is to configure environment variables after installation. The following is an example:

Install Java in Linux:

Java installation does not need to use a specific package manager, directly download the Binary Package on the Oracle official website, such as: jdk-7u17-linux-x64.tar.gz unzip to get a folder, copy the folder to the directory you want to install. Next, configure the following: (for example, put the above file under/OPT)

Root permission to open the/etc/profile file, and add the following at the end:

JAVA_HOME =/opt/jdk1.7.17PATH = $JAVA_HOME/bin:$PATHCLASSPATH = .:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jarexport JAVA_HOME PATH CLASSPATH

Execute./etc/profile to make the modified profile take effect immediately. (Note: The space following it)

In fact, the purpose of this configuration is to set path and classpath, which is consistent with setting environment variables in windows. And then test it with javac or Java-version.
Install Ruby in Linux:

1. installation using the Package Manager (rvm)

Install curl using apt-Get

Sudo apt-Get install curl

Install rvm using curl

Curl-l https://get.rvm.io | bash-S

Reload the. bash_profile in the current terminal

Source ~ /. Bash_profile

Note: To make sure Bash is run as a login shell and rvm is loaded, please follow the steps in the doc integrating rvm with gnome-Terminal

Check the required dependencies for installing Ruby

Rvm requirements

Install the required pre-reqs for installing Ruby

Sudo/usr/bin/apt-Get install build-essential bison Open SSL libreadline6 libreadline6-dev curl Git-core zlib1g \
Zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev Autoconf \
The libc6-dev ncurses-Dev

Install Ruby 1.9.2 using rvm

Rvm install 1.9.2

Set the ruby version to 1.9.2

Rvm use 1.9.2

Check that the correct version of Ruby has been set

Ruby-V

Install bundler gem

Gem install bundler

Install rake gem

Gem install rake

 

2. Download the Binary Package and decompress it for installation.

In the preceding example, the Java installation tool is as follows: ruby-1.9.3-20.tar.gz. decompress the tool and configure the environment variable.

3. source code compilation and Installation

Download the source code, decompress the package, go to the directory, and run:

./Configure-Prefix =/usr/local/Ruby (=/usr/local/Ruby is the directory where Ruby will be installed)

Make & make install is OK

 

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.