Install Node.js v4.4.4_node.js in Centos7

Source: Internet
Author: User

Let's take a look at how to compile the installation through the source code

1, install the dependent package

[root@1c3b4a5a8f31 ~]# yum -y install gcc gcc-c++ openssl-devel

2, download the source package

[Root@1c3b4a5a8f31 ~]# wget http://www.nodejs.org/dist/latest/node-v0.12.5.tar.gz
[root@1c3b4a5a8f31 ~]# Tar- ZXVF node-v0.12.5.tar.gz
[root@1c3b4a5a8f31 ~]# CD node-v0.12.5

3, configuration, compilation, installation

[Root@1c3b4a5a8f31 ~]#./configure--prefix=/usr/local/node 
[root@1c3b4a5a8f31 ~]# make && make install


4. Configure NODEJS Environment

[Root@1c3b4a5a8f31 ~]# vim/etc/profile

#set nodejs env
export node_home=/usr/local/node
export path=$ Node_home/bin: $PATH
export node_path= $NODE _home/lib/node_modules: $PATH

[root@1c3b4a5a8f31 ~]# source/etc/ Profile    #重启生效

5. Test whether the installation is successful

[Root@1c3b4a5a8f31 ~]# node-v
v0.12.5
[root@1c3b4a5a8f31 ~]# npm-v-2.11.2


and see how to install it through Yum.

Install Node.js

Landing CentOS

Terminal login $ ssh root@192.168.0.23 IP can be within the LAN or public network IP.

Download node

According to your system, find https://nodejs.org/en/download/in the website you need to download the version. For example, I choose the Linux Binaries (x86/x64) 64bit, right click on the version you need to copy the address, through the command download Nodejs install compression package.

$ wget https://nodejs.org/dist/v4.4.4/node-v4.4.4-linux-x64.tar.xz

If you wget command does not exist, you can install the download tool wget by yum install wget command. If you are the smallest version of the CentOS need to be installedyum -y install gcc make gcc-c++ openssl-devel wget

Decompression Installation

# No use of ' gzip ' compression remove ' z ' parameter
$ sudo tar--strip-components 1-xzvf node-v*-c/usr/local


View Installation

You can see if the installation was successful! General installation will be reported error messages, if no error message, you can call the node command to test the success of the installation!

NODE-V # will output version information
# v6.9.1

npm-v # will output version information
# 3.10.8

Finally, let's take a look at NPM to install

Step1.

Enter http://nodejs.org/dist/Download the required version of the Node.js
(for example, current version of the latest link http://nodejs.org/dist/v0.12.7/, download node-v0.12.7-linux-x64.tar.gz)

Step2.

Extract:tar –xf node-v0.12.7-linux-x64.tar.gz

Configure environment variables (add bin under node to environment variables)

Step3. (using Express Application Builder)

Perform:npm install express-generator –g

After the end will be prompted the following content.

Step4.

Follow the prompts to execute the command CD test

NPM Install

Then you can do NPM start.

can open browser, address bar input localhost:3000

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.