OK Let's first download a wave of mongodb~ (64-bit Ubuntu)
Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_ 64-3.0.6.tgz # download tar -ZXVF mongodb-linux-x86_64-3.0 6.tgz # unzip MV mongodb-< Span class= "PLN" >linux-x86_64-3.06//usr/local /mongodb # copy the unpacked package to the specified directory
Next Configure the environment variable pressure yajing--!
Export PATH=<mongodb-Install-directory>/bin:$PATH
<mongodb-install-directory> for your MongoDB installation path. As the/usr/local/mongodb of this article
Create the next database directory! and create the configuration file by the way!
mkdir -p /data/db
directory has been created, note:/DATA/DB is the default starting database path for MongoDB (--dbpath).
# vi/data/mongo/mongodb.conf
mongodb.conf The file configuration parameters (easy to start or start directly from the command line configuration parameters)
/strong>dbpath=/data/mongo/
Logpath=/data/mongo/mongo.log
logappend=true
fork=true
port=27017
--------------------------------
Note: logappend prevent the log from being deleted
Fork background run (prevent terminal restart shutdown)
Now let's start MONGO!
First: Configuration file startup
# bin/mongod-f/data/mongo/mongodb.conf
The second type: Configuration parameters start
# Mongod--fork--logpath=usr/local/mongodb/log/mongodb.log--logappend--dbpath=usr/local/mongodb/data/db/
Let's test it.
Bin/mongo
Terminal output
MongoDB Shell version:3.0.6
Connecting To:test
>
Success!
Attached: The Pits encountered! Keng! Keng!
I. Need to delete Mongod.lock
Two. External network if access needs to go to etc/mongodb.conf to change bind_ip to 0.0.0.0 or comment out
Linux configuration mongodb~