Reference Original: http://www.cnblogs.com/kaituorensheng/p/5118226.html
Linux installation is a perfect implementation! 1. MongoDB installation, startup, shutdown
1.1 Download the installation package
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.3.tgz
1.2 Unzip and move to the / usr / local / mongodb directory
tar -zxvf mongodb-linux-x86_64-3.0.3.tgz
sudo mv mongodb-linux-x86_64-3.0.3 / usr / local / mongodb
1.3 Directory description
cd / usr / local / mongodb
1.3.1 Directory bin
The mongod under it is a MongoDB server process, mongo is a client, and other commands are used for other purposes, such as MongoDB file export, etc.
Establish soft links so that they can be easily implemented
sudo ln -s / usr / local / mongodb / bin / mongod / usr / local / bin / mongod
sudo ln -s / usr / local / mongodb / bin / mongo / usr / local / bin / mongo
1.3.2 data directory
If there is no data directory, create a new data directory
mkdir data
1.4 Start mongoDB
Secret start
mongod --dbpath = / usr / local / mongodb / data / --logpath = / usr / local / mongodb / data / mongodb.log --logappend &
Secret boot
mongod --dbpath = / usr / local / mongodb / data / --logpath = / usr / local / mongodb / data / mongodb.log --auth --logappend &
After starting, the default port is 27017.
netstat -tunlp
1.5 Starting the client
No certification required
$ sudo mongo
Requires certification
sudo mongo -u user -p pwd ip: port / db_log
1.6 Close mongod
Wall crack recommendation
Enter mongo shell
use admin
db.shutdownServer ()
or
sudo killall mongod
Resolutely oppose kill -9 mongod
2. Set password
Note: V3 version mongoDB no longer uses addUser, but instead uses db.createUser.
Set password without secret conditions:
Add user and password to library test_mongo_auth
use test_mongo_auth
db.createUser (
{
user: "userabc",
pwd: "123456",
roles: ["readWrite", "dbAdmin"]
}
)
Start in secret conditions, you will be prompted for a password
4. RockMongo (php written similar to phpmyadmin)
I installed it according to the manual in the nginx environment: PHP manual address: http://php.net/manual/zh/mongo.installation.php
Install on * NIX
carried out:
sudo pecl install mongo
Add the following to the php.ini file:
extension = mongo.so
If pecl is running above the memory limit, make sure the memory_limit setting in php.ini is at least 128MB.
Note: Be sure to restart php-fpm after the installation is complete! !! !! And the server! !! !!
Restart php-fpm
service php-fpm restar
Restart the server NGINX
/ usr / local / nginx / sbin / nginx
Login web operation interface
http: //address/rockmongo/index.php
User name: (default) admin
Password: (default) admin
[linux] [MongoDB] mongodb learning (a): MongoDB installation, management tools,