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 build node.js Development Environment in Linux Virtual Machine

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "how to build the node.js development environment in the Linux virtual machine". The editor shows you the operation process through the actual case, the operation method is simple, fast and practical. I hope this article "how to build the node.js development environment in the Linux virtual machine" can help you solve the problem.

one。 Install the linux system

(linux is installed to skip this step)

Recommended choice for virtual machine: virtualbox or vmware (Professional permanent Activation Code: 5a02h-au243-tzj49-gtc7k-3c61n)

I use vmware here.

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

{

Client operating system: other

Version: other 64-bit

Virtual machine name: node.js

Location: d:\ vm\ node.js

Other default

}

The virtual machine is built, and the configuration is shown in the figure.

There is a problem to note here: it is the network adapter of the virtual machine. I am choosing the bridging mode here. In this mode, the vmware virtual operating system is like an independent host in the local area network (the host and the virtual machine are in a peer-to-peer position). 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 choose nat mode.

Then download the image, the system I choose centos, of course, other linux systems are also possible. Click the first one directly on Baidu centos download, and then download it by dvdiso. About 4gb.

After downloading the image, click Virtual Machine Settings, and select use iso Image File in the cd/dvd tab.

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

1. During the installation process, the language uses the default language (english), and then click continue to continue.

two。 Click here

Select basic web server, select development tools on the right, and then click done to return.

3. Click

Although this is the default and the choice

But you still have to click again to select

Then click the button in the lower right corner to start the installation.

While waiting for installation, click

Start setting the administrator password. Wait for the installation to complete after setup, about 3-5 minutes. Click the reboot button to restart after the installation is complete.

User name after restart: root password: the password just set during installation.

At this point, the installation of centos is complete, and here are some simple settings.

Use vi to modify the configuration file of the network card in the etc/sysconfig/network-scripts/ directory, and change the last onboot to yes. Because the network card is turned off by default in centos7. Save and exit wq after the modification is completed. As shown below

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

Enter the command ifconfig to see that the ip address has been obtained.

If you are not relieved, you can try ping. At this time, the virtual machine has been connected to the external network.

II. Installation of nodejs and related software

Write a xshell installation first. (optional, does not install or affect nodejs development)

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

Xshell: detailed installation steps

Personal feeling is relatively easy to use, after the installation, click New, enter the name node, host node, port number 22, and then enter the login name root, password can enter centos. Because the virtual machine here is bridged, in order not to change the ip of the virtual machine in the future, I added 192.168.1.59 node at the end of the file c:\ windows\ system32\ drivers\ etc\ hosts. In the future, the ip of the virtual machine will be fixed in this to facilitate subsequent development.

/ * I am the wayward dividing line * * /

Now install a few things in centos (must! )

1. Install an epel and enter the command

Yum install epel-release

two。 Install nodejs, enter the command

Yum install nodejs

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

3. Install the mongodb server and enter the command

Yum install mongodb-server

4. Install the mongodb client and enter the command

Yum install mongodb

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

5. Install redis, enter the command

Yum install redis

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

After all the above steps are completed, the construction of the node.js development environment is completed. Worthy of applause congratulations!

III. Node test run

Let's simply write a Mini Program to run it.

Vim test.js

Var name = "qin"; console.log ("hello" + name)

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

This is the end of the introduction to "how to build the node.js development environment in the Linux virtual machine". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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: 244

*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

Development

Wechat

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

12
Report