node.js環境の構築
久しぶりの更新ですね。はい。
だいぶ乗り遅れている感は否めないですけど、今回は node.js 環境を構築してみました。
今回の環境
環境 : Ubuntu 11.04
node.js : 0.4.12
環境構築
まずは、公式サイト(http://nodejs.org)に取りに行きます。
開発版(unstable)と、安定板(stable)があると思うのですが
今回は安定板の"0.4.12"を使用したいと思います。
続いて、取ってきたものを解凍。
$ tar -xvf node-v0.4.12.tar.gz
"node-v0.4.12"ディレクトリの中に移動して"configure"コマンドを。
するとエラーが返ってきます。
~/node-v0.4.12$ ./configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : not found
Checking for function SSL_library_init : not found
Checking for header openssl/crypto.h : not found
/home/tetsu/node-v0.4.12/wscript:341: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message.
どうも、開発版のOpenSSLが必要なよう。 開発版が必要だなんて流石最新だね。うん。()
ということで、ここはaptitudeを使ってサクっと。
開発版も3と4があるみたいですが、今回は4を利用しました。 理由は…(ry。
# aptitude install libcurl4-openssl-dev
そしてもう一度"configure"コマンドを。
~/node-v0.4.12$ ./configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : yes
Checking for library util : yes
Checking for library rt : yes
- libeio ---
Checking for library pthread : yes
Checking for function pthread_create : yes
Checking for function pthread_atfork : yes
Checking for futimes(2) : yes
Checking for readahead(2) : yes
Checking for fdatasync(2) : yes
Checking for pread(2) and pwrite(2) : yes
Checking for sendfile(2) : yes
Checking for sync_file_range(2) : yes
- libev ---
Checking for header sys/inotify.h : yes
Checking for function inotify_init : yes
Checking for header sys/epoll.h : yes
Checking for function epoll_ctl : yes
Checking for header port.h : not found
Checking for header poll.h : yes
Checking for function poll : yes
Checking for header ['sys/types.h', 'sys/event.h'] : not found
Checking for header sys/queue.h : yes
Checking for function kqueue : not found
Checking for header sys/select.h : yes
Checking for function select : yes
Checking for header sys/eventfd.h : yes
Checking for function eventfd : yes
Checking for SYS_clock_gettime : yes
Checking for library rt : yes
Checking for function clock_gettime : yes
Checking for function nanosleep : yes
Checking for function ceil : yes
Checking for fdatasync(2) with c++ : yes
'configure' finished successfully (2.629s)
今度は上手くいったみたいで。
続いて
$ make
Waf: Leaving directory `/home/tetsu/node-v0.4.12/build'
'build' finished successfully (4m0.755s)
そして、インストール。
$ sudo make install
Waf: Leaving directory `/home/tetsu/node-v0.4.12/build'
'install' finished successfully (0.135s)
最後に確認。
$ node -v
v0.4.12
おkですね。(*´ω`*)