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:
DownloadYou 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
ExtractGo 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 VariablesOpen 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