日期:2014-05-16  浏览次数:20466 次

Ubuntu 编译安装node.js

到node.js网站下载最新压缩包,然后解压到/opt目录下。

安装GCC后,运行./configure

root@html5viewer1:/opt/node-v0.10.20# ./configure 
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'clang': 0,
                 'gcc_version': 48,
                 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_prefix': '',
                 'node_shared_cares': 'false',
		 'node_shared_http_parser': 'false',
		 'node_shared_libuv': 'false',
		 'node_shared_openssl': 'false',
		 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'x64',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk
root@html5viewer1:/opt/

然后开始编译,成功后安装,我都是在root用户下运行这些命令。

make
...
make install
最后node可执行程序安装在/usr/local/bin目录下,npm安装在/usr/local/lib/node_modules目录下

可以运行make test进行测试。