Skip to content

Instantly share code, notes, and snippets.

@huksley
Last active December 25, 2015 12:19
Show Gist options
  • Save huksley/6975108 to your computer and use it in GitHub Desktop.
Save huksley/6975108 to your computer and use it in GitHub Desktop.
Install mongodb latest with auth admin:123
#!/bin/sh
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get -y install mongodb-10gen
sudo service mongodb start
echo "use admin; db.addUser({ user: 'admin', pwd: '123', roles: [ 'userAdminAnyDatabase' ] });" | mongo
sudo service mongodb stop
echo "rest = true" | sudo tee /etc/mongodb.conf
sudo sed -re "s/\\#auth = true/auth = true/g" /etc/mongodb.conf
sudo service mongodb start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment