Created
April 1, 2019 19:54
-
-
Save JAlbertoGonzalez/58b409737379cd15f80fb27421fa045f to your computer and use it in GitHub Desktop.
MongoDB installation & configuration on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Install MongoDB | |
| sudo apt-get install mongodb | |
| 2. Edit configuration file to allow any access w/out user/password authentication | |
| sudo nano /etc/mongodb.conf | |
| Search line: | |
| # noauth = true | |
| Uncomment the file removing "#" | |
| If the line doesn't exists, write down yourself. | |
| 3. Start/Restart mongodb service | |
| sudo service mongodb start | |
| sudo service mongodb restart | |
| 4. Login into mongodb | |
| > mongo | |
| 5. Use the database name you will | |
| > use MyAwesomeDatabase; | |
| 6. Create user credentials | |
| > db.createUser({ | |
| user: "userName", | |
| pwd: "PaSSWoRD", | |
| roles: [{ | |
| role: "userAdminAnyDatabase", | |
| db: "admin" | |
| }] | |
| }); | |
| 7. Logout from database | |
| > exit; | |
| 8. Edit /etc/mongodb.config and restore # noauth = true | |
| 9. Restart the service | |
| > sudo service mongodb restart | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment