Install and configure Node. js v4.0.0 on Ubuntu 14.04/15.04

Source: Internet
Author: User
Tags install node

Install and configure Node. js v4.0.0 on Ubuntu 14.04/15.04

Hello everyone, Node. JS 4.0 was released. This popular server-side JS platform incorporates Node. js and io. js Code, version 4.0 is the product of the combination of the two projects-now merged into a code library. The major change this time is that Node. js encapsulates the Google V8 JS engine of version 4.5, which is consistent with the current Chrome. Therefore, keeping up with the release of V8 can make Node. js run faster and safer, and make better use of many language features of ES6.


Node JS

The main goal of the release of Node. js 4.0 is to provide a simple upgrade path for io. js users, so there are not many important API changes this time. The following describes how to install and configure Node. js on Ubuntu Server.

 

Basic System Installation

Node can run perfectly on Linux, Macintosh, and Solaris systems. Ubuntu is suitable for linux releases. This is why we try to install Node. js on ubuntu 15.04. Of course, we can also install Node. js through the same steps on ubuntu 14.04.

 

1) system resources

The basic system resources required by Node. js depend on your architecture requirements. In this tutorial, we will perform the installation on a server with 1 GB memory, 1 GHz processor, and 10 GB disk space. The installation is minimal and no Web server or database server is required.

 

2) system updates

Before installing Node. js, we recommend that you update the system to the latest patch and upgrade package. Therefore, log on to the system and run the following command with the superuser:

  1. #apt-get update

 

3) install Dependencies

Node. js only requires some basic system and software functions on your server, such as 'make', 'gcc ', and 'wget. If you have not installed them, run the following command to install them:

  1. #apt-get install python gccmake g++wget

 

Download Node JS v4.0.0 of the latest version.

Visit the Node JS Download Page to Download the source code.


Nodejs download

Copy the link of the latest source code, and then usewgetDownload the following command:

  1. #wget https://nodejs.org/download/rc/v4.0.0-rc.1/node-v4.0.0-rc.1.tar.gz

Run the following command after the download is complete:tarDecompress:

  1. #tar-zxvf node-v4.0.0-rc.1.tar.gz


Wget nodejs

 

Install Node JS v4.0.0

Now you can use the downloaded source code to compile Node. js. Before compilation, you need to switch to the decompressed directory of the source code on ubuntu server and run the configure script to configure the source code.

  1. root@ubuntu-15:~/node-v4.0.0-rc.1# ./configure


Installing NodeJS

Run the 'Make install' command to compile and install Node. js:

  1. root@ubuntu-15:~/node-v4.0.0-rc.1#make install

The make command will take several minutes to complete the compilation, and wait quietly for a while.

 

Verify Node. js Installation

Once the compilation task is completed, we can start to verify whether the installation is OK. Run the following command to confirm the Node. js version.

  1. root@ubuntu-15:~# node -v
  2. v4.0.0-pre

Run the command line without ParametersnodeThe REPL (Read-Eval-Print-Loop, Read-execute-output-Loop) mode is displayed. It has a simplified emacs row editor, you can run JS interactively and view the running results.


Node version

 

Compile a test program

We can also write a very simple terminal program to test whether the installation is successful and works properly. To do this, we will create a "test. js" file, which contains the following code:

  1. root@ubuntu-15:~#vimtest.js
  2. var util =require("util");
  3. console.log("Hello! This is a Node Test Program");
  4. :wq!

Now, in order to run the above program, run the following command in the command line.

  1. root@ubuntu-15:~# node test.js


Node Program

Running the above program in an environment where Node JS is successfully installed will get the output shown on the screen. This program loads the class "util" to the variable "util, then run the terminal task with the object "util", console. the log command is similar to the cout in C ++.

 

Conclusion

That's all. If you are just using Node. js to develop applications, I hope this article will show you about Node. js by installing and running Node. js on ubuntu. Finally, we can expect significant performance improvement from Node JS v4.0.0.

You may also like the following content about Node. js:

How to install Node. js in CentOS 7

Build a Node. js development environment in Ubuntu 14.04

Install and configure the Node. js development environment in javasru 12.04

Getting started with Node. Js [PDF + related Code]

Node. js Development Guide hd pdf Chinese version + source code

Node. js getting started Development Guide

Compile and install Node. js in Ubuntu

Node. js details: click here
Node. js: click here



Related Article

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.