Install NodeJS in centos 6.5

Source: Internet
Author: User
Tags install node

Install NodeJS in centos 6.5
Install NodeJS in centos 6.5

References
Recently, I want to install a node on the server. js for a moment, some of the articles found in the early stage are downloaded and compiled by myself, but there are always various problems, especially problems during compilation. The following problems will be reported:
WARNING: C++ compiler too old, need g++ 4.8 or clang 3.4 (CXX=g++)
However, you can use yum to check for updates and find that no updates are available. Therefore, you can only manually upgrade g ++ 4.8, not to mention whether or not you can download, compile, and install it, it is said that even if there are still various problems after the upgrade, now it is much more convenient to use the binary version for installation. If you do not do research and only use the application,We strongly recommend that you install Node. js in binary mode. I download the latest version v7.5.0. The following describes how to install the binary version:

Download

You can download node. js latest version, then upload to the server via ftp tool, or directly download on the server terminal using the wget command (I downloaded the node-v7.5.0-linux-x86 version at that time, other versions please check the above link and then replace it ):

$ wget http://nodejs.org/dist/latest/node-v7.5.0-linux-x86.tar.gz  
Extract

Go to the server terminal, find the uploaded or downloaded installation package, and decompress it.

$ tar -zvxf node-v7.5.0-linux-x86.tar.gz  

Move to the installation directory and rename

$ mv node-v7.5.0-linux-x86 /opt/node
Configure Environment Variables

Open the profile file under the etc directory

$ vi /etc/profile

Add the following content at the end of the file:

export NODE_HOME=/opt/nodeexport PATH=$NODE_HOME/bin:$PATH

Effective environment variable

$ source /etc/profile

You can also add the preceding environment variable to the. bash_profile file in the root directory.

$ vi ~/.bash_profile
export NODE_HOME=/opt/node export PATH=$NODE_HOME/bin:$PATH
Check version
$ node -vv7.5.0
$ npm -v4.1.2

If you have any questions, please refer

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.