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