Home > Hosting > Server

How to build a node.js development environment in Linux

2023-07-20 16:35:38

<p style="text-align: left;">This article mainly explains how to build a node.js development environment for Linux. Interested friends may wish to take a look. The method described in this article is simple, quick and practical. Next, let the editor show you how to build a node.js development environment for Linux!</p><p><br/></p><p style="text-align: left;">1. Because there is no server here, we build a Linux environment locally through a virtual machine, so we first need to download virtuabox, Baidu or Google search for virtuabox download.</p><p style="text-align: left;"><img src="//img.freeonlinedomain.com/uploads/allimg/20230721/1-230H1144441462.jpg" title="" alt="QQ截图20230721144426.jpg"/></p><p style="text-align: left;">After entering, you can choose according to your operating system. Here we take window as an example.</p><p style="text-align: left;">2. Create a virtual machine, virtualbox installation is not difficult, the next step is enough. After installation, create a virtual machine, click New, and then set as shown in the figure, because we install centos64 here. If you install other linux, you can choose correspondingly. The next step is the next step in the whole process. Just choose the default</p><p><br/></p><p><br/></p><p><br/></p><p style="text-align: left;">The memory can be set according to your own computer memory</p><p><br/><br/><br/><br/></p><p style="text-align: left;">3. After the virtual machine is created, you need to install a mirror image for it, that is, the operating system. Install centos here and go to the next one on the Internet.</p><p><br/></p><p style="text-align: left;">If you are using a router to access the Internet, select the bridge here</p><p><br/></p><p style="text-align: left;">and then start the network, select the default language, try not to choose Chinese, so as to avoid some unnecessary problems, choose the software</p><p style="text-align: left;"><img src="//img.freeonlinedomain.com/uploads/allimg/20230721/1-230H11453152H.jpg" title="" alt="2.jpg"/></p><p style="text-align: left;">to install the hard disk, enter the key points, cancel it first, then select</p><p><br/></p><p style="text-align: left;">and wait for the installation. During the installation process, you can choose to set the password of the root user, or add other</p><p style="text-align: left;">After installation, you need to set up the virtual machine network card settings,</p><p style="text-align: left;">vi /etc/sysconfig/network-scripts/ifcfg-enp0s3</p><p style="text-align: left;">Open the configuration file through vi, if you use vi, after opening the file, press i on the keyboard to enter the modification mode, change the onboot attribute to yes, press esc, shitf+:, and then wq to exit and save.</p><p><br/></p><p style="text-align: left;">systemctl restart network</p><p style="text-align: left;">Restart the network card through the command, if there is an assigned address, it will be fine,</p><p style="text-align: left;">If you don’t understand the above steps, you can Baidu the virtual machine installation, and centos installation, etc., you can have a detailed introduction and specific parameter configuration</p><p style="text-align: left;">4. Install the necessary software. After the installation process, you will be asked to choose, y/n, all of which are y, and the following software installations are the same</p><p style="text-align: left;">yum install epel-release</p><p style="text-align: left;">Install nodejs,</p><p style="text-align: left;">yum install nodejs</p><p style="text-align: left;">Install the server of mongodb-server</p><p style="text-align: left;">yum install mongodb-server</p><p style="text-align: left;">Install mongodb</p><p style="text-align: left;">yum install mongodb</p><p style="text-align: left;">Install redis</p><p style="text-align: left;">yum install redis</p><p style="text-align: left;">5. The basic environment is installed, and you can enter node directly by entering node on the command line. Then let&#39;s see how to link and develop under the window. Here we use securecrtportable. You can download xshell, which is the same.</p><p><br/></p><p style="text-align: left;">After clicking the connection, you can use this command line to operate.</p><p style="text-align: left;">Then open sublime text and download the sftp plug-in. This plug-in can map and synchronize the local project directory and the project directory on the server.</p><p><br/></p><p style="text-align: left;">Set it as follows, but one thing to note is that the remote-path corresponds to the server directory. It only needs an existing directory. Then there are some other parameter configurations. You can configure when to upload synchronously and so on.&nbsp;</p><pre class="brush:bash; hljs json" style="margin-top: 8px; margin-bottom: 8px; padding: 15px; box-sizing: border-box; overflow-x: auto; background-color: rgb(240, 242, 245); color: rgb(45, 48, 55); font-size: 14px; border: 1px solid rgb(219, 225, 232); border-radius: 4px; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-all; text-align: left;">{ //The&nbsp;tab&nbsp;key&nbsp;will&nbsp;cycle&nbsp;through&nbsp;the&nbsp;settings&nbsp;when&nbsp;first&nbsp;created//visit&nbsp;http://wbond.net/sublime_packages/sftp/settings&nbsp;For&nbsp;help//sftp,&nbsp;ftp&nbsp;or&nbsp;ftps&nbsp;&quot;type&quot;:&nbsp;&quot;sftp&quot;,//Connection&nbsp;method&nbsp;&quot;savebefore&nbsp;upload&quot;:&nbsp;true,//Upload&nbsp;&quot;upload_on_save&quot;&nbsp;before&nbsp;saving:&nbsp;true,//Upload&nbsp;&quot;sync_down_on_open&quot;:&nbsp;false&nbsp;when&nbsp;saving, Sync_skip&nbsp;deletes&nbsp;&quot;:&nbsp;false, Sync_same_age&nbsp;&quot;:&nbsp;true, Confirm_downloads&nbsp;&quot;:&nbsp;false, &#39;confirm_sync&#39;:&nbsp;true, Confirm_overwrite_new&nbsp;&quot;:&nbsp;false, &quot;Host&quot;:&nbsp;&quot;nodejs&quot;,//host&nbsp;name&nbsp;or&nbsp;address&nbsp;&quot;user&quot;:&nbsp;&quot;root&quot;,//user&nbsp;name&nbsp;for&nbsp;connection&nbsp;&quot;password&quot;:&nbsp;&quot;sunlandong&quot;,//password//&quot;port&quot;:&nbsp;&quot;22&quot;,&nbsp;&quot;remote_path&quot;:&nbsp;&quot;/home/nodejs/&quot;,//mapping&nbsp;directory&nbsp;between&nbsp;local&nbsp;directory&nbsp;and&nbsp;server&nbsp;directory.&nbsp;It&nbsp;should&nbsp;be&nbsp;noted&nbsp;that&nbsp;the&nbsp;server&nbsp;directory&nbsp;must&nbsp;have&nbsp;&quot;ignore_regexes&quot;&nbsp;in&nbsp;advance:&nbsp;&quot;[ .&nbsp;sub&nbsp;lime&nbsp;-&nbsp;(project&nbsp;|&nbsp;workspace)&nbsp;&quot;,&quot;&nbsp;sftp&nbsp;configure&nbsp;(-&nbsp;alt&nbsp;&nbsp;&nbsp;d?)?&nbsp;&nbsp;.&nbsp;json&nbsp;&quot;, Sftp&nbsp;settings&nbsp;&nbsp;.&nbsp;Json&nbsp;&quot;,&quot;/venv/&quot;,&quot;&nbsp;&nbsp;.&nbsp;Svn/&quot;,&quot;&nbsp;&nbsp;.&nbsp;Hg/&quot;,&quot;&nbsp;&nbsp;.&nbsp;Git/&quot;, .&nbsp;bzr&nbsp;&quot;,&quot;&nbsp;_darcs&nbsp;&quot;,&quot;&nbsp;cvs&nbsp;&quot;,&quot;&nbsp;&nbsp;.&nbsp;Ds_store&nbsp;&quot;,&quot;&nbsp;thumbs&nbsp;&nbsp;.&nbsp;Db&nbsp;&quot;,&quot;&nbsp;desktop&nbsp;&nbsp;.&nbsp;Ini&nbsp;&quot; ],//Ignore&nbsp;rules//&quot;file_permissions&quot;:&nbsp;&quot;664&quot;,//&quot;dir_permissions&quot;:&nbsp;&quot;775&quot;,//&quot;extra_list_connections&quot;:&nbsp;0,&nbsp;&quot;connect_timeout&quot;:&nbsp;30, //&quot;Keepalive&quot;:&nbsp;120,//&quot;ftp_passive_mode&quot;:&nbsp;true,//&quot;ftp_obey_assive_host&quot;:&nbsp;false,//&quot;ssh_key_file&quot;:&nbsp;&quot;~/.&nbsp;ssh/id_sa&quot;,//&quot;sftp_flags&quot;:&nbsp;[&quot;-&nbsp;f&quot;,&nbsp;&quot;/path/to/ssh_config&quot;],//&quot;preserve&nbsp;modification_times&quot;:&nbsp;false,//&quot;remote_time_offset_inhours&quot;:&nbsp;0,//&quot;remote_encoding&quot;:&nbsp;&quot;utf-8&quot;,//&quot;remote_locale&quot;:&nbsp;&quot;c&quot;,//&quot;allow_config_upload&quot;:&nbsp;false,}</pre><p><br/></p>


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us