Installing Nodejs and MongoDB in a Linux environment

Source: Internet
Author: User

Previous words

This article will describe in detail how to install Nodejs and MongoDB under Linux environments

NodeJS

1. Download the Nodejs installation package in the Linux environment on the official website

2. Upload the installation package to the server via XFTP software

3. Unzip the. Tar.xz Suffix installation package

$XZ-D* * *-XVF  ***.tar

4, after decompression, the current directory appears under the Node-v8.6.0-linux-x64 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 the soft link with the absolute path

6. Verification

Mongodb

1, download the installation package on the official website

2. Upload to Server

3. Decompression

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

4. Copy the unpacking package to the specified directory

MV mongodb-linux-x86_64-3.4. 9 /usr/local/mongodb

5. Add the MongoDB executable file to the path path in the bin directory

Export Path=/usr/local/mongodb/bin: $PATH

6. Create a database directory

MongoDB data is stored in the DB directory in the database directory, but this directory is not created automatically during the installation process, so you need to manually create the data directory and create the DB directory in the data directory. The following instance creates the data directory under the root directory (/)

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

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. Configuring 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. Setting Up Soft Links

Ln-s/usr/local/mongodb/bin/mongod/usr/local/bin/-S  /usr/local/mongodb/conf/mongodb.conf/usr/local /bin/mongodb.conf

11, firewall open port 27017, and restart the firewall

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

12. Open MongoDB Service

Mongod-f mongodb.conf

Installing Nodejs and MongoDB in a Linux environment

Related Article

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.