Nodejs Study Notes-nodejs Installation

Source: Internet
Author: User

To learn a technology, we must first set up the development environment. It is easy to set up the nodejs development environment under Ubuntu, And it is OK to directly use apt-Get.

Sudo apt-Get install nodejs

If you do not like apt-get directly, you can download the source code package from the official website and compile and install it directly.

First install some necessary Libraries

Sudo apt-Get install build-essential OpenSSL libssl-dev PKG-config

Then download nodejs

Wget http://nodejs.org/dist/node-latest.tar.gz

Extract

Tar zxvf node-latest.tar.gz

Go to the nodejs folder for compilation and installation.

CD Node

./Configure

Make

Sudo make install

To delete the file, run sudo make Uninstall.

After the environment is set up, you can start to develop the nodejs program. Of course, the instance program needs to start from Hello world! Start.

var http = require('http');http.createServer(function(req,res){    res.writeHead(200,{'content-type':'text/html'});    res.write('Hello world!');    res.end();}).listen(3000);console.log('running on port 3000');

Run commands

Enter localhost: 3000 in the node hello. js browser, as shown in:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.