Home Operation and Maintenance Linux Operation and Maintenance How to build a node.js development environment on Linux virtual machine

How to build a node.js development environment on Linux virtual machine

May 28, 2023 pm 10:43 PM
linux node.js

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 New Virtual Machine, select to install the 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 defaults;

}

The virtual machine is now built, and the configuration is as shown shown.

How to build a node.js development environment on Linux virtual machine

#There is a problem that needs attention: 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. Of course, other Linux systems are also available. Directly click 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. During the installation process, use the default language (english), and then click continue to continue.

2. Click here

How to build a node.js development environment on Linux virtual machine

# to select basic web server, select development tools on the right, and then click done to return. How to build a node.js development environment on Linux virtual machine

3. Click

How to build a node.js development environment on Linux virtual machine

Although the default and selection are

How to build a node.js development environment on Linux virtual machine

But you still have to click again to select

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

While waiting for the installation, click

How to build a node.js development environment on Linux virtual machine

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 just set during the installation process.

At this point centos installation is complete, 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
How to build a node.js development environment on Linux virtual machine
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. How to build a node.js development environment on Linux virtual machine
If you are worried, you can also try pinging. At this time, the virtual machine has been connected to the external network.

2. Nodejs and related software installation

Write an xshell installation first. (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 terminals.

Personally, I feel it is easier to use. After the installation is completed, 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:\windows\system32\drivers\etc\hosts file. In the future, the IP address 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 and enter the command

yum install epel-release

2. Install nodejs, enter the command

yum install nodejs

After waiting for the download and installation to complete, enter the command node --version to check whether the version number is installed.

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

等待下载安装完成后,输入命令mongo --version查看版本号是否安装完成

5.安装redis,输入命令

yum install redis

等待下载安装完成后,输入命令redis-cli --version查看版本号是否安装完成

三.node测试运行

下面简单写个小程序来运行一下。

vim test.js

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

wq保存退出,输入命令node test.js ,即可看到结果。

How to build a node.js development environment on Linux virtual machine

The above is the detailed content of How to build a node.js development environment on Linux virtual machine. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
How to make an HTTP request in Node.js? How to make an HTTP request in Node.js? Jul 13, 2025 am 02:18 AM

There are three common ways to initiate HTTP requests in Node.js: use built-in modules, axios, and node-fetch. 1. Use the built-in http/https module without dependencies, which is suitable for basic scenarios, but requires manual processing of data stitching and error monitoring, such as using https.get() to obtain data or send POST requests through .write(); 2.axios is a third-party library based on Promise. It has concise syntax and powerful functions, supports async/await, automatic JSON conversion, interceptor, etc. It is recommended to simplify asynchronous request operations; 3.node-fetch provides a style similar to browser fetch, based on Promise and simple syntax

Fixed the failure to upload files in Windows Google Chrome Fixed the failure to upload files in Windows Google Chrome Jul 08, 2025 pm 02:33 PM

Have problems uploading files in Google Chrome? This may be annoying, right? Whether you are attaching documents to emails, sharing images on social media, or submitting important files for work or school, a smooth file upload process is crucial. So, it can be frustrating if your file uploads continue to fail in Chrome on Windows PC. If you're not ready to give up your favorite browser, here are some tips for fixes that can't upload files on Windows Google Chrome 1. Start with Universal Repair Before we learn about any advanced troubleshooting tips, it's best to try some of the basic solutions mentioned below. Troubleshooting Internet connection issues: Internet connection

How to manage groups on Linux How to manage groups on Linux Jul 06, 2025 am 12:02 AM

To manage Linux user groups, you need to master the operation of viewing, creating, deleting, modifying, and user attribute adjustment. To view user group information, you can use cat/etc/group or getentgroup, use groups [username] or id [username] to view the group to which the user belongs; use groupadd to create a group, and use groupdel to specify the GID; use groupdel to delete empty groups; use usermod-aG to add users to the group, and use usermod-g to modify the main group; use usermod-g to remove users from the group by editing /etc/group or using the vigr command; use groupmod-n (change name) or groupmod-g (change GID) to modify group properties, and remember to update the permissions of relevant files.

How to find my private and public IP address in Linux? How to find my private and public IP address in Linux? Jul 09, 2025 am 12:37 AM

In Linux systems, 1. Use ipa or hostname-I command to view private IP; 2. Use curlifconfig.me or curlipinfo.io/ip to obtain public IP; 3. The desktop version can view private IP through system settings, and the browser can access specific websites to view public IP; 4. Common commands can be set as aliases for quick call. These methods are simple and practical, suitable for IP viewing needs in different scenarios.

What is the code number of Bitcoin? What style of code is Bitcoin? What is the code number of Bitcoin? What style of code is Bitcoin? Jul 22, 2025 pm 09:51 PM

As a pioneer in the digital world, Bitcoin’s unique code name and underlying technology have always been the focus of people’s attention. Its standard code is BTC, also known as XBT on certain platforms that meet international standards. From a technical point of view, Bitcoin is not a single code style, but a huge and sophisticated open source software project. Its core code is mainly written in C and incorporates cryptography, distributed systems and economics principles, so that anyone can view, review and contribute its code.

System requirements to install linux System requirements to install linux Jul 20, 2025 am 03:49 AM

Linuxcanrunonmodesthardwarewithspecificminimumrequirements.A1GHzprocessor(x86orx86_64)isneeded,withadual-coreCPUrecommended.RAMshouldbeatleast512MBforcommand-lineuseor2GBfordesktopenvironments.Diskspacerequiresaminimumof5–10GB,though25GBisbetterforad

How to make PHP container support automatic construction? Continuously integrated CI configuration method of PHP environment How to make PHP container support automatic construction? Continuously integrated CI configuration method of PHP environment Jul 25, 2025 pm 08:54 PM

To enable PHP containers to support automatic construction, the core lies in configuring the continuous integration (CI) process. 1. Use Dockerfile to define the PHP environment, including basic image, extension installation, dependency management and permission settings; 2. Configure CI/CD tools such as GitLabCI, and define the build, test and deployment stages through the .gitlab-ci.yml file to achieve automatic construction, testing and deployment; 3. Integrate test frameworks such as PHPUnit to ensure that tests are automatically run after code changes; 4. Use automated deployment strategies such as Kubernetes to define deployment configuration through the deployment.yaml file; 5. Optimize Dockerfile and adopt multi-stage construction

How to use the `shutdown` command How to use the `shutdown` command Jul 15, 2025 am 12:26 AM

The shutdown command of Linux/macOS can be shut down, restarted, and timed operations through parameters. 1. Turn off the machine immediately and use sudoshutdownnow or -h/-P parameters; 2. Use the time or specific time point for the shutdown, cancel the use of -c; 3. Use the -r parameters to restart, support timed restart; 4. Pay attention to the need for sudo permissions, be cautious in remote operation, and avoid data loss.

See all articles