1. Install dependency packages
sudo apt-get install g curl libssl-dev apache2-utils
sudo apt-get install git-core
2. Download source code
git clone git://github.com/ry/node.git
This step is due to poor network conditions The error keeps showing Cloning to node...
You can download the source code directly from the official website and unzip it to the folder of your account.
The file name was changed to node.
3. Compile
Three commands:
./configure
make
sudo make install
Screenshot after successful installation:
4. Test
Write the following small program, name it example.js, and save it in the node folder.
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/');
Execute the following command:
Run result:
For the convenience of application, you should also set environment variables, install npm, and other tasks later, right?
Just got it, need to learn more...
The annoying confidentiality check, sorting out the information...