Forked from JAlbertoGonzalez/mongodb_install_configure
Created
October 24, 2021 09:48
-
-
Save sg-gs/3b8c9be70726f3c6cc595afda71037c2 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