1. Download the installation package
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.9.tgz
After the download is complete, unzip the installation package
tar zxf mongodb-linux-x86_64-3.2.9.tgz
2. Installation preparation
Create the MongoDB installation directory, database directory, and log directory and log files
mkdir -p /home/emily/MongoDB/data/db
mkdir -p /home/emily/MongoDB/data/logs
touch /home/emily/MongoDB/data/logs/mongodb.log
Move mongodb to the created directory
mv mongodb-linux-x86_64-3.2.9.tgz /home/emily/MongoDB
3. Start MongoDB
(1) Direct start
./mongod -dbpath=/home/emily/MongoDB/data/db --logpath=/home/emily/MongoDB/data/logs/mongodb.log --logappend --fork --auth
(2) Configure the startup parameters into the file to start
vi /home/emily/MongoDB/mongodb-linux-x86_64-3.2.9/bin/mongdb.conf
# database file location
dbpath=/data/db
# log file location
logpath=/data/logs/mongodb.log
# Append to log
logappend=true
# Default 27017
port=27017
# Requires login permission
auth=true
# Whether to run as a daemon
fork=true
start the service
./mongod --config /home/emily/MongoDB/mongodb-linux-x86_64-3.2.9/bin/mongdb.conf
(Note: If the user password is not required, just remove the auth of the startup parameters)
to be continued……