Mac Under Mac, if you like to use homebrew, you can install it with just one line:
brew install node
Otherwise, just You can consider manual installation. The steps are as follows:
Install Xcode
Install git
Run the following command line to compile node.js
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
Ubuntu Install dependency packages
sudo apt-get install g curl libssl-dev apache2-utils
sudo apt-get install git-core
Run the following command line:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
Windows Use cygwin to install node. The steps are as follows:
Install cygwin
In the cygwin directory, run setup.exe to install the packages in the list below
devel → openssl
devel → g -gcc
devel → make
python → python
devel → git
run cygwin
Run the following command line:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
Centos
yum install gcc-c openssl-devel
wget --no-check-certificate https://github.com/ry /node/tarball/v0.3.3
tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gz
cd ry-node-v0.3.3-0-g57544bac1
./configure
make
make install
Hello Node.js! Write a small program such as hello_node.js to verify whether the installation is correct:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.jsn');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
Use node to run this code
node hello_node.js
Server running at http://127.0.0.1:8124/
Now, open http://127.0.0.1:8124/ with a browser, you should be able to see a good message.