Install the Upstream version of Node. js on Ubuntu

Source: Internet
Author: User
Tags tar xz install node

Install the Upstream version of Node. js on Ubuntu
Install the Upstream version of Node. js on Ubuntu

Node. js is a software platform that can be used to quickly develop and build scalable Web applications. Node. js uses JavaScript as its scripting language and achieves high throughput through non-blocking I/O and single-thread event loops.
Node. js contains a built-in HTTP server library that allows it to run directly on a Web server without using external software, such as Apache or Nginx, in addition, more control can be provided when the Web server is running.
To install Node. js on the Ubuntu server, you must first update the system. In fact, before installing any software package, make sure that the software warehouse is up-to-date:

# sudo apt-get update 

Once the system is updated, you need to install the build-Essential Package. This package contains the base library for building the Debian software package.

# sudo apt-get install build-essential 

You also need to install the curl tool. Curl is a library and can be used for HTTP requests in the command line.

# sudo apt-get install curl 

After installing curl, you must install all the packages required by Node. js. There are multiple methods to install Node. js. The simplest method is to execute:

# sudo apt-get install Nodejs 

However, the latest Node. js version may not be added to the Ubuntu standard library. To ensure that the latest version is used, we should download the source code, compile and install it.
First, add the environment variable to the. bashrc configuration file:

# echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc# . ~/.bashrc 

Then, create the directory required for the installation process:

# mkdir ~/{local,node-latest-install} 

Then, go to the latest installation directory, use curl to download the Node. js document, and decompress it with the tar tool.

# cd ~/node-latest-install# curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 

Next, set the parameters to install Node. js for the current user and run:

# ./configure --prefix=~/local# make install 

Once Node. js is installed, install the Node. js Package Manager NPM, which is also the official Software Package Manager of Node. js.

# curl https://npmjs.org/install.sh | sh 

Check whether the installation is successful by checking the Node. js version. Execute:

# node -v 

OK.

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.