Aliyun ecs-centos installation node.js v4.2.6 Tutorial

Source: Internet
Author: User
Tags aliyun

Why choose v4.2.6 version, because the Ghost Blog support the highest version is v4.2.x.

I'll introduce the NVM version manager to install and manage the Node.js version, NVM (Node version Manager), as the name suggests, is Node.js version management software that can easily switch between node.js versions, project source code GitHub

NVM version Manager installs and manages the Node.js version

Download and install the NVM script

Yum install-y wget
wget-qo-https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | Bash
SOURCE ~/.bash_profile

List the versions that you want

NVM list-remote

Returns the following results

        ...
        v0.10.4
        ...
        v0.12.0
        v0.12.1
        v0.12.2
        v0.12.3
        v0.12.4
        ...
         v4.2.0
         v4.2.1
         v4.2.2
          v4.2.3
         v4.2.4
          v4.2.5
         v4.2.6

v5.10.1
v5.11.0
v6.0.0

Install the appropriate version

NVM Install v4.2.6

To view installed versions

NVM List
-> v4.2.6
System

Toggle Version

NVM use v0.10.30

Set the default version

NVM alias Default v0.10.30

Old version installation Aliyun Ecs-centos installation Node.js v0.12.4

First, download Node.js source package (not compiled)

1, you need to download the latest Nodejs version in http://nodejs.org/:

Taobao Mirror address: http://npm.taobao.org/mirrors/node/

cd/usr/local/src/
wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz

2, extract the source code

Tar zxvf node-v0.10.24.tar.gz

3. Compile and install

CD node-v0.10.24
./configure--prefix=/usr/local/node/0.10.24
Make
Make install

4, configure Node_home, enter profile edit environment variable

Vim/etc/profile

5. Set the NODEJS environment variable to add the following on the export PATH USER LOGNAME MAIL HOSTNAME histsize Histcontrol Line:

#set for Nodejs
Export node_home=/usr/local/node/0.10.24
Export path= $NODE _home/bin: $PATH

6.: Wq Save and exit, compile/etc/profile to make configuration effective

Source/etc/profile
7. Verify that the installation configuration is successful

Node-v
8, output v0.10.24 to indicate a successful configuration

NPM Module Installation Path

/usr/local/node/0.10.24/lib/node_modules/

Second, download node.js binary source package (this is a compiled program, can be used directly, as long as the environment variable can be set)

1, you need to download the latest Nodejs version in http://nodejs.org/

Cd/usr/local
wget http://nodejs.org/dist/v0.12.4/node-v0.12.4-linux-x64.tar.gz
Tar xzvf node-v0.12.4-linux-x64.tar.gz
CD node-v0.12.4-linux-x64

2. Set environment variable

Vim/etc/profile
#在export PATH USER LOGNAME MAIL HOSTNAME histsize Histcontrol Join
Export node_home=/usr/local/node-v0.12.4-linux-x64
Export path= $NODE _home/bin: $PATH
#保存退出
Source/etc/profile

Node-v #查看node. js version
3. Figure:/etc/profile after editing

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.