Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Node.js on Ubuntu 14.04Comp15.04

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to configure Node.js on Ubuntu 14.04Universe 15.04. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

The main goal of the Node.js 4.0 release is to provide an easy upgrade path for io.js users, so there are not many major API changes this time. Let's take a look at how to easily install and configure Node.js on ubuntu server.

I. basic system installation

Node runs perfectly on all Linux,Macintosh,Solaris systems, and Ubuntu is a good fit for linux distributions. This is why we are trying to install Node.js on ubuntu 15.04. of course, we can use the same steps to install it on 14.04.

1. System resources

The basic system resources required for Node.js depend on your architectural needs. This tutorial will be done on a server with 1GB memory, 1GHz processor and 10GB disk space, with minimal installation, without the need to install a Web server or database server.

two。 System update

Before we install Node.js, it is recommended that you update the system to the latest patches and upgrade packages, so log in to the system and run the following command using the superuser:

The code is as follows:

# apt-get update

3. Installation dependency

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

The code is as follows:

# apt-get install python gcc make gaming + wget

Download the latest version of Node JS v4.0.0

Copy the link to the latest source code and download it with wget, with the following command:

The code is as follows:

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

After the download is complete, use the command tar to extract:

The code is as follows:

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

Third, install Node JS v4.0.0

You can now start compiling Node.js using the downloaded source code. Before starting compilation, you need to change to the unzipped directory of the source code on ubuntu server and run the configure script to configure the source code:

The code is as follows:

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

Now run the command 'make install' to compile and install Node.js:

The code is as follows:

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

The make command takes a few minutes to compile and wait quietly for a while.

Verify the installation of Node.js

Once the compilation task is complete, we can begin to verify that the installation is OK. We run the following command to confirm the version of Node.js.

The code is as follows:

Root@ubuntu-15:~# node-v

V4.0.0-pre

Running node without arguments from the command line will enter REPL (Read-Eval-Print-Loop, read-execute-output-loop) mode, which has a simplified version of the emacs line editor through which you can run JS interactively and view the results.

Fifth, write the test program

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

Now to run the above program, run the following command on the command line:

The code is as follows:

Root@ubuntu-15:~# node test.js

Running the above program in an environment where Node JS is successfully installed will get the output shown above on the screen. The program loads the class "util" into the variable "util", and then runs the terminal task with the object "util". The command console.log acts like cout in C++.

That's it. If you are just starting to use Node.js to develop applications, I hope this article will give you a general idea of Node.js by installing and running Node.js on ubuntu.

This is the end of this article on "how to configure Node.js on Ubuntu 14.04Compact 15.04". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report