Home > Web Front-end > JS Tutorial > Node.js development environment setup

Node.js development environment setup

高洛峰
Release: 2016-11-02 15:24:55
Original
1309 people have browsed it

1. Install the Linux system

(You can skip this step if you have installed Linux)

Recommended virtual machine options: VirtualBox or Vmware (Professional version permanent activation code: 5A02H-AU243-TZJ49-GTC7K-3C61N)

  I use Vmware here .

 After installing Vmware, click on New Virtual Machine, select to install the operating system later, and then configure it. The virtual machine settings are as follows:

{

   Guest operating system: other;

  Version: other 64-bit;

  Virtual machine name: node.js;

  Location: D: VMnode.js;

  Other defaults;

}


The virtual machine is built and the configuration is as shown on the right. Node.js development environment setup

There is a problem that needs attention here: it is the network adapter of the virtual machine. I choose bridge mode here. In this mode, the operating system virtualized by VMWare is like an independent host in the LAN (the host and the virtual machine are in a peer-to-peer status), and it can access any machine in the network. (My host IP here is 192.168.1.49 and the virtual machine IP is 192.168.1.59). If your network environment is not suitable for bridging, please select NAT mode.

Then download the image. I choose centos as the system here. Of course, other Linux systems are also available. Directly click on the first one on Baidu centos download, and then download DVDISO. About 4GB. ​

After downloading the image, click Virtual Machine Settings and select the ISO image file in the CD/DVD tab.

Click Start, go to our virtual machine and select the first one to start the installation.

1. The installation process is in progress, use the default language (English), and then click continue to continue.

2. Click here Node.js development environment setup

to select Basic Web Server, select Development Tools on the right, and then click Done to return.

Node.js development environment setup

3. Click Node.js development environment setup, although it is the default and selected here, you still need to click again to select Node.js development environment setup

and then click the button in the lower right corner to start the installation. .

While waiting for the installation, click Node.js development environment setup to start setting the administrator password. After setting up, wait for the installation to complete, about 3-5 minutes. After the installation is complete, click the reboot button to restart.

Username after restart: root Password: The password you just set during the installation process.

CENTOS is now installed. Let’s simply make some settings.

Use vi to modify the network card configuration file in the etc/sysconfig/network-scripts/ directory, and modify the last ONBOOT to yes. Because by default in centos7, the network card is turned off. After the modification is completed, wq save and exit. As shown in the figure below

Node.js development environment setup

After modifying the configuration file, enter the command systemctl restart network to restart the virtual machine network.

Enter the command ifconfig and you can see that the IP address has been obtained.

Node.js development environment setup

If you are worried, you can also try pinging www.baidu.com. At this time, the virtual machine has been connected to the external network.

2. Nodejs and related software installation

First write an xshell installation. (Optional, not installing will not affect Nodejs development)

xshell: Xshell can be used to access remote servers under different systems under the Windows interface, so as to better achieve the purpose of remote control of the terminal.

Please download from Baidu, and click Next to install.

Personally, I find it easier to use. After the installation is complete, click New, enter the name node, host node, port number 22, and then enter the login name root and password to enter centos. Because the virtual machine here is bridged, so that the IP of the virtual machine will not change in the future, I added 192.168.1.59 node at the end of the C:WindowsSystem32driversetchosts file. In the future, the IP of the virtual machine will be fixed here to facilitate subsequent development.

/*****************I am the willful dividing line*******************************/

Now install a few things in centos (must!)

1. Install an epel, enter the command yum install epel-release

2. To install nodejs, enter the command yum install nodejs. After the download and installation is completed, enter the command node --version to check whether the version number is installed.

3. To install the mongodb server, enter the command yum install mongodb-server

4. To install the mongodb client, enter the command yum install mongodb, wait for the download and installation to complete, enter the command mongo --version to check whether the version number is installed

5. To install redis, enter the command yum install redis. After waiting for the download and installation to complete, enter the command redis-cli --version to check whether the version number is installed.

node.js

After all the above steps are completed, the development environment for node.js is completed. It deserves applause and congratulations! ! !

Three.node test run

Let’s simply write a small program to run it.

vim test.js
var name = "qin";console.log("hello "+name);
Copy after login

wq Save and exit, enter the command node test.js to see the results.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template