


How to build a node.js development environment on Linux virtual machine
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.
#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
# to select basic web server, select development tools on the right, and then click done to return.
3. Click
Although the default and selection are
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
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
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.
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 ,即可看到结果。
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!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools
