download & install

Amazon Linux

  1. unzip and check README
  2. mkdir -p /data/db; chown ec2-user:ec2-user /data/db
  3. export LC_ALL=en_US.UTF-8
  4. echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
  5. ./bin/mongod

specify data folder

mongod --dbpath /Users/dev/mongodb_data

mongo db create user & security

  • start mongo no security
>use admin
> db.createUser({
 user:'admin', pwd: 'admin',
 customData: {desc: 'The admin user for admin db'},
 roles: ['readWrite', 'dbAdmin', 'clusterAdmin']
  • start mongod with --auth option
mongod  --auth
Community content is available under CC-BY-SA unless otherwise noted.