The development environment of Node.js in Linux virtual machine and build _linux

Source: Internet
Author: User
Tags install mongodb mongodb server redis yum install mongodb administrator password centos port number install redis

First of all, Nodejs this oh, some people think it is a language, in fact, it is a platform. Here is the next topic: VMware Virtual Machine node.js development environment to build

One. Install Linux system

(Linux is installed to skip this step)

Virtual machine Recommended selection: VirtualBox or Vmware (Professional version of Permanent Activation Code: 5A02H-AU243-TZJ49-GTC7K-3C61N)
I use VMware here.
After installing VMware, click New Virtual Machine, choose to install the operating system later, and then configure. The virtual machine settings are as follows:

{

Client operating system: other;

Version: other 64 bits;

Virtual machine name: node.js;

Position: D:\VM\node.js;

other defaults;

}

The virtual machine is built and configured as shown in the picture on the right.

Here is a question to note: The Virtual machine network adapter, I am here to select the bridge mode. In this mode, VMware's virtual operating system is like a stand-alone host in the local area network (the host and the virtual machine are in a peer-to-peer position), and it can access any machine in the network. (Here my host IP 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 mirror, the system I choose CentOS here, of course, other Linux system is also possible. Direct Baidu CentOS Download Click First, then Dvdiso download. About 4GB.

When the download image is complete, click on the virtual machine settings and the CD/DVD tab to choose to use the ISO image file.

Click Start, go to our virtual machine, and then select First to start the installation.

1. In the installation process, the language uses the default language (中文版), and then click Continue to continue.

2. Click here

Select Basic Web Server, select development Tools on the right, and click Done to return.

3. Click here Default and select but still want to click again Select

Then click on the lower right corner of the button to start the installation.

While waiting for the installation process, click Start to set the administrator password. Wait for installation to complete after Setup, about 3-5 minutes. When the installation is complete, click the Reboot button to reboot.

User name after reboot: root password: is the password set during the installation process.

Here CentOS the installation is complete, the following simple to do some settings.

Use VI to modify the NIC configuration file under the etc/sysconfig/network-scripts/directory, modify the last onboot to Yes. Because the CENTOS7 by default, the NIC is turned off. Wq Save exit after the modification is complete. As shown in the figure below

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

The input command ifconfig can see that an IP address has been obtained.
If you do not trust, you can ping www.baidu.com try. The virtual machine is already connected to the extranet.

Two. Nodejs and related software installation

Write a Xshell installation first. (optional, do not install also does not affect NODEJS development)

The Xshell:xshell can be used in Windows interface to access servers under different remote systems, thus achieving the goal of remotely controlled terminals better.

Xshell: Detailed installation Steps http://www.xshellcn.com/xsh_column/xs-az.html

Personal feeling more useful, after installation, click New, enter name node, host node, port number 22, and then enter the login name root, the password can enter the CentOS. Because I am here the virtual machine is bridging the way, in order to later the virtual machine IP will not change, I C:\Windows\System32\drivers\etc\hosts file finally add 192.168.1.59 node. Later, the virtual machine IP will be fixed in this, convenient follow-up development.

/***************** I am the wayward line ****************************/

Now CentOS to install a few things first (must!) )

1. Install a epel, enter command

Yum Install Epel-release

2. Install Nodejs, enter command

Yum Install Nodejs

After waiting for the download installation to complete, enter the command node--version to see if the version number is complete.

3. Install MongoDB server, enter command

Yum Install Mongodb-server

4. Install MongoDB client, enter command

Yum Install MongoDB

After waiting for the download installation to complete, enter the command MONGO--version to see if the version number is installed

5. Install Redis, enter command

Yum Install Redis

After waiting for the download installation to complete, enter the command redis-cli--version to see if the version number is installed

All the above steps are completed, that is, the Node.js development environment has been built. Welcome to congratulate!!!

Three. Node test run

Let's write a small program to run it.

Vim Test.js

var name = "Qin";
Console.log ("Hello" +name);

Wq Save exit, enter command node test.js, you can see the result.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.