centos6 编译安装nodejs4.3

官网下载源码包

https://nodejs.org/en/download/

source code

#下载

wget https://nodejs.org/dist/v4.3.2/node-v4.3.2.tar.gz

#解压

tar zxvf node-v4.3.2.tar.gz

cd node-v4.3.2

./configure --prefix=/usr/local/node

提示gcc版本过低,需要4.8以上版本

 

提示:WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)

错误: make[1]: *** [/root/apps/node-v4.2.2/out/Release/obj.target/v8_base/deps/v8/src/accessors.o] Error 1 make[1]: Leaving directory `/root/apps/node-v4.2.2/out’ make: *** [node] Error 2

升级gcc版本到4.8+

down vote
EL6 gcc-4.8 http://www.hop5.in/yum/el6/repoview/gcc.html

or this

http://puias.princeton.edu/data/puias/DevToolset/6/x86_64/ /etc/yum.repos.d/DevToolset.repo

[DevToolset-2]
name=RedHat DevToolset v2 $releasever - $basearch
baseurl=http://people.centos.org/tru/devtools-2/$basearch/
enabled=1
gpgcheck=0
Testing run

# yum install devtoolset-2-gcc-4.8.2 devtoolset-2-gcc-c++-4.8.2
# /opt/rh/devtoolset-2/root/usr/bin/gcc --version
export

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version

然后回到node源码文件目录

make clean

重新配置

./configure --prefix=/usr/local/node

这样安装位置会在/usr/local/node

make

make install

完成安装

最后添加全局命令

ln -s /usr/local/node/bin/* /usr/local/bin 

posted on 2016-03-08 18:40  walter371  阅读(497)  评论(0编辑  收藏  举报

导航