源码编译Nodejs 4.6 on CentOS6

1、本来是要按照个newman程序,无奈newman必须要node版本>=4,所以不得不安装node4.6

下载地址:https://nodejs.org/dist/v4.6.0/node-v4.6.0.tar.gz

2、下载之后解压编译安装

./configure --prefix=/opt/node-v4.6.0

无奈报错:

WARNING: 

3、So,不得不得到更高版本的g++

(1)、curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo

(2)、rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern
(3)、yum install -y devtoolset-3

(4)、scl enable devtoolset-3 bash    #临时改变gcc版本,需要永久生效的话,写在配置文件中(.bashrc)

4、之后执行

  make && make install

5、安装node完毕后,要配置一下node环境变量

  (vim /etc/profile.d/node.sh ;

  PATH=$PATH:/opt/node-v4.6.0/bin

   source /etc/profile.d/node.sh),

6、验证一下安装成功是否

  node --version

  npm --version

7、再来安装newman,并验证( newman --version )

  npm install newman --global

注:copr.fedoraproject.org 提供了第三方构建的 devtoolset-3/4 的仓库, 可直接添加yum源repo后体验 devtoolset-3(gcc-4.9.2) devtoolset-4(gcc-5.2.1),

免去自己构建编译 gcc 麻烦 )

devtoolset-3 - Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform. It provides current versions of the GNU Compiler Collection, GNU Debugger, Eclipse development platform, and other development, debugging, and performance monitoring tools.

原文地址:https://www.cnblogs.com/taoge007/p/5961348.html