Home >Web Front-end >JS Tutorial >Installing Node.js and mongodb notes on CentOS_node.js
I have heard of Node.js before. I just know that it can be applied to the server side, but I don’t know many specific things. After listening to Yuan Feng's sharing "Node.js breaks away from browser Javascript" at QCon today, I suddenly had the urge to try it out immediately.
The installation steps of Node.js are relatively simple without too many detours. The main reference document is:
Building and Installing Node.js
1. Install Python
According to the reference documentation, compiling and installing Node.js from source code requires python2.6 or above, but you can only get 2.4.3 through yum install python.x86_64, so you must also compile and install python through source code. Here is the command:
2. Install Node.js
According to the instructions in the document, git checkout code has never been successful, whether using git://github.com/joyent/node.git or https://github.com/joyent/node.git. Therefore, you can only download it from github and then compile and install it. The specific steps are as follows:
3. Install npm
npm is a package manager used to install the node.js library. The installation command is quite simple:
At this point, the installation is complete.
In the above content, the installation is completed in just a few simple steps. Although it seems that the installation is successful, the actual situation requires us to write a program to verify it. Since I am also learning MongoDB recently, I wrote a method to read the MongoDB database: calculate the total number of logs with actionId 772.
4. Install mongodb driver using
根据提示执行:
5. 编写测试代码mongo.js
现在可以说前面的安装过程是正确,开了个好头。