Install NodeJS, mongoDB, and nodejsmongodb in Linux

Source: Internet
Author: User

Install NodeJS, mongoDB, and nodejsmongodb in Linux
Previous

This article describes how to install NodeJS and mongoDB in Linux

 

NodeJS

1. Download The NodeJS installation package in the Linux environment from the official website.

2. Upload the installation package to the server through xftp

3. uncompress The. Tar. xz suffix installation package

$xz -d ***.tar.xz$tar -xvf  ***.tar

4. After decompression, the node-v8.6.0-linux-x64 directory appears under the current directory, node is installed in the directory

5. Find the current directory where the node-v8.6.0-linux-x64 directory is located and set soft links in absolute paths

6. Verification

 

MongoDB

1. Download the installation package from the official website.

2. upload to the server

3. Extract

$tar -zxvf  mongodb-linux-x86_64.3.4.9.tgz

4. Copy the decompressed package to the specified directory.

mv mongodb-linux-x86_64-3.4.9 /usr/local/mongodb

5. Store the MongoDB executable file in the bin directory and add itPATHPath

export PATH=/usr/local/mongodb/bin:$PATH

6. Create a database directory

MongoDB data is stored in the db directory of the data directory, but this directory is not automatically created during the installation process. Therefore, you need to manually create the data DIRECTORY and create the db directory in the data directory. The following example creates the data directory under the root directory (/)

[Note]/data/db is the default database path (-- dbpath) started by MongoDB)

mkdir -p /data/db

7. Add the conf directory under/usr/local/mongodb/and add the mongodb. conf configuration file.

mkdir confcd conf vi mongodb.conf

8. Configure the mongodb. conf file

dbpath=/data/dbport=27017logappend=truejournal=true
quiet=truelogpath=/usr/local/mongodb/log/mongodb.log

9. Create a log file

mkdir logscd logstouch mongodb.log

10. Set soft links

ln -s /usr/local/mongodb/bin/mongod /usr/local/bin/mongodln -s  /usr/local/mongodb/conf/mongodb.conf /usr/local/bin/mongodb.conf

11. Open the firewall port 27017 and restart the firewall.

firewall-cmd --permanent --zone=public --add-port=27017/tcpfirewall-cmd --reload

12. Enable the mongodb Service

mongod -f mongodb.conf

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.