Several methods for installing Node. js in CentOS 7

Source: Internet
Author: User
Tags centos


I. Source code installation

1. Download the source code (visit the official website to view the latest version)

Wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz

2. Decompress the source code

Tar xzvf node-v * & cd node-v *

3. Install necessary compilation software

Sudo yum install gcc-c ++

4. Compile

./Configure
Make

5. Compile and install

Sudo make install

6. Check the version (test whether the installation is successful)

Node -- version

II. Install with compiled versions

1. Download the compiled version

The latest version can be obtained on the official website: Portal

Cd ~
Wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz

2. Extract

Sudo tar -- strip-components 1-xzvf node-v *-C/usr/local

3. Test and install

Node -- version

III. Install with EPEL

1. Download EPEL

Sudo rpm-I http://download.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

2. Installation

Sudo yum install nodejs

3. Test and install

Node -- version

4. (optional) install the npm management package

Sudo yum install npm

4. NVM installation

As the name suggests, NVM (Node version manager) is the version management software of Node. js. It can be easily switched between different versions of Node. js. The Project source code is GitHub.

1. Download and install the NVM script

Curl https://raw.githubusercontent.com/creationix/nvm/v0.13.1/install.sh | bash
Source ~ /. Bash_profile

2. List required versions

Nvm list-remote

The returned results are as follows:

...
V0.10.29
V0.10.30
V0.11.0
V0.11.1
V0.11.2
V0.11.3
V0.11.4
V0.11.5
V0.11.6
V0.11.7
V0.11.8
V0.11.9
V0.11.10
V0.11.11
V0.11.12
V0.11.13

3. Install the appropriate version

Nvm install v0.10.30

4. View installed versions

Nvm list

-> V0.10.30
System

5. Switch version

Nvm use v0.10.30

6. Set the default version

Nvm alias default v0.10.30

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.