8 Simple steps to install MongoDB with authentication on EC2 AMI Linux

Jan 10th, 2017

8 Simple steps to install MongoDB with authentication on EC2 AMI Linux

In this tutorial, we will show you how to install MongoDB with authentication on EC2 AMI Linux.

Prerequisites:

  • You have ec2 instance running
  • You have root access to ec2 instance

Step 1: Connect to ec2 instance using pem/ppk file

For MongoDB 3.0, create below file using vi or any other editor

vi /etc/yum.repos.d/mongodb-org-3.0.repo

Add below content in above created file

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

Step 2: Install mongodb using below command

sudo yum install -y mongodb-org

Step 3: Start MongoDB service using below command

sudo service mongod start

Step 4: Start MongoDB on reboot

You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:

sudo chkconfig mongod on

Step 5: Connect to mongo shell

Once service is started you need to connect to mongo shell for creating user. To connect to mongo shell use below command

mongo

If you find below error when using mongo command

“Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly” Add export as mentioned below

export LC_ALL=C

Step 6: Select Admin

Once connected successfully to mongo, select admin

use admin

Step 7: Create User

Create user as per below:

db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)

Create user for specific database
To create user for a particular database, repeat step 6 with below command

use

To create user for above database:

db.createUser(
{
user: "",
pwd: "mypassword",
roles: [ { role: "readWrite", db: "muddle" }]
}
)

Edit /etc/mongod.conf
For mongo 3.x, Add this to the config

security:
authorization: "enabled"
Then run below command

service mongod restart

Step 8:

If you want to connect MongoDB remotely, edit below file with vi or any other editor

vi /etc/mongod.conf

Add remove IP in bindIp as per below and restart mongodb service
bindIp: 127.0.0.1,8.8.8.8

129 Comments

  • bán cây sầu riêng giống at 4:22 am, January 1, 2024

    I feel that is one of the so much important information for me.
    And i am glad reading your article. However want to observation on few general things, The web site style is great, the articles
    is really nice : D. Just right task, cheers

  • Edwardo at 3:02 pm, January 26, 2024

    You stated it well!

  • Lottiewam at 9:47 pm, February 19, 2024

    I recently tried cbd lotion after the pre-eminent leisure and was pleasantly surprised by the results. Initially skeptical, I start that it significantly helped with my desire and be in the land of nod issues without any remarkable side effects. The oil was unoppressive to use, with nitid dosage instructions. It had a mild, vulgar taste that was not unpleasant. Within a week, I noticed a patent improvement in my overall well-being, instinct more blas‚ and rested. I cognizant the natural approximate to wellness CBD offers and procedure to go on using it.

  • Opulence Limo Service in Singapore at 11:49 am, February 21, 2024

    Hey very interesting blog!

  • least tax possible at 11:51 am, February 21, 2024

    You are so interesting! I do not suppose I’ve truly read through something like this before.

    So wonderful to discover somebody with unique thoughts on this subject.
    Really.. thanks for starting this up. This web site is one thing that’s needed on the internet,
    someone with a bit of originality!

  • nitro logo golf balls at 11:54 am, February 21, 2024

    I am actually thankful to the owner of this site who has
    shared this great post at at this time.

  • https://techpegg.site/ at 11:55 am, February 21, 2024

    Hurrah! Finally I got a weblog from where I be able to really
    get useful data concerning my study and knowledge.

  • Working Capital at 11:59 am, February 21, 2024

    I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored material stylish.
    nonetheless, you command get got an impatience over that
    you wish be delivering the following. unwell unquestionably come further formerly again as exactly the
    same nearly a lot often inside case you shield this hike.

  • Romeo at 12:04 pm, February 21, 2024

    Get more nutritional info, the very best train packages, health motivation and a FREE e-book with over
    a hundred ideas for shedding stomach fats here.

    My page … Romeo

  • slot mpo terbaru at 12:06 pm, February 21, 2024

    Thanks for ones marvelous posting! I really enjoyed reading it, you might
    be a great author. I will always bookmark your blog and will come back later on.
    I want to encourage you continue your great posts, have a nice afternoon!

  • slot mpo terbaru at 12:18 pm, February 21, 2024

    Its such as you learn my thoughts! You appear to understand so
    much about this, such as you wrote the ebook in it or something.
    I feel that you simply can do with a few % to pressure the message home a little bit, but
    other than that, this is great blog. A fantastic
    read. I will certainly be back.

  • khela88 at 12:36 pm, February 21, 2024

    Wow! This blog looks just like my old one! It’s on a
    completely different subject but it has pretty much the same
    page layout and design. Superb choice of colors!

  • Affordable carpet cleaning Henderson at 12:36 pm, February 21, 2024

    Undeniably believe that which you said. Your favorite reason seemed to be on the
    web the simplest thing to be aware of. I say to you, I definitely get annoyed while people think
    about worries that they just do not know about. You managed to hit the nail upon the top and also defined out the whole thing without
    having side effect , people could take a signal.
    Will likely be back to get more. Thanks

  • Tredsafe Shoes Offer at 12:40 pm, February 21, 2024

    Heya i am for the first time here. I found
    this board and I in finding It truly helpful & it helped me
    out a lot. I’m hoping to offer one thing again and aid others such as you helped me.

  • https://techpegg.site/ at 12:52 pm, February 21, 2024

    Excellent blog here! Also your website loads up very fast!
    What web host are you using? Can I get your affiliate link to
    your host? I wish my website loaded up as quickly as yours lol

  • ngentot at 1:23 pm, February 21, 2024

    Greetings! I know this is kind of off topic but I
    was wondering if you knew where I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding
    one? Thanks a lot!

  • slot gampang scatter at 1:29 pm, February 21, 2024

    Hey there would you mind letting me know which hosting company you’re
    working with? I’ve loaded your blog in 3 different web browsers
    and I must say this blog loads a lot faster then most.
    Can you suggest a good internet hosting provider at
    a reasonable price? Thanks, I appreciate it!

  • gsnslot link alternatif at 1:52 pm, February 21, 2024

    This excellent website certainly has all the info I needed concerning this
    subject and didn’t know who to ask.

  • Slot online at 2:20 pm, February 21, 2024

    Unquestionably believe that which you said. Your favorite justification seemed to
    be on the net the simplest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that
    they plainly don’t know about. You managed to hit
    the nail upon the top and defined out the whole thing without having
    side effect , people could take a signal. Will probably be back
    to get more. Thanks

  • astronomy signs at 2:50 pm, February 21, 2024

    I do trust all the ideas you have presented for your post. They are very convincing and will certainly
    work. Nonetheless, the posts are too short for novices.

    May you please lengthen them a little from subsequent time?
    Thank you for the post.

  • spirit dog training reviews at 3:16 pm, February 21, 2024

    It’s an remarkable post in support of all the online viewers; they will obtain benefit from it I am sure.

  • Agen Sbobet at 3:22 pm, February 21, 2024

    When some one searches for his essential thing, so he/she wishes
    to be available that in detail, therefore that thing is maintained over here.

  • kontol at 3:35 pm, February 21, 2024

    I’m gone to inform my little brother, that he should also go to see this webpage
    on regular basis to take updated from most up-to-date news.

  • https://techpegg.site/ at 4:29 pm, February 21, 2024

    Very energetic blog, I liked that bit. Will there
    be a part 2?

  • https://topcyber.site/ at 12:06 am, February 22, 2024

    I’m not sure where you’re getting your information, but great topic.
    I needs to spend some time learning more or understanding
    more. Thanks for fantastic information I was looking for this info for my mission.

  • Exclusive Singapore Limo Services at 8:12 am, February 22, 2024

    Very great post. I simply stumbled upon your blog and wished to say that I’ve really enjoyed surfing around your blog posts.
    In any case I’ll be subscribing on your feed and I hope you write again very soon!

  • betting at 10:56 pm, February 22, 2024

    Wow, amazing blog layout! How long have you been blogging for?
    you made blogging look easy. The overall look of your site is
    wonderful, let alone the content!

  • Providing High-quality Airport Transportation at 5:22 am, February 23, 2024

    Very nice post. I just stumbled upon your blog
    and wanted to say that I’ve truly enjoyed browsing your blog posts.
    In any case I’ll be subscribing to your rss feed and I hope you write again soon!

  • I used to be able to find good advice from your blog articles.

  • slot mpo terbaru at 8:22 am, February 24, 2024

    I have been browsing online more than three hours today, yet I never found any interesting article like
    yours. It is pretty worth enough for me. Personally, if all
    webmasters and bloggers made good content as
    you did, the web will be much more useful than ever
    before.

  • BennieSlorb at 5:39 pm, February 24, 2024

  • Richardhek at 12:40 pm, February 25, 2024

  • gsnslot login at 11:08 pm, February 25, 2024

    you’re in point of fact a excellent webmaster. The site loading speed is
    amazing. It sort of feels that you’re doing any unique trick.

    Moreover, The contents are masterpiece. you’ve
    performed a fantastic job on this subject!

  • gsnslot daftar at 7:35 pm, February 26, 2024

    I’m not sure exactly why but this weblog is loading very
    slow for me. Is anyone else having this issue or is it a
    issue on my end? I’ll check back later on and see if the problem still exists.

  • DavidCop at 1:22 am, February 28, 2024

  • Lazarowhone at 9:12 am, February 28, 2024

    Забудьте о низких позициях в поиске! Наше SEO продвижение https://seopoiskovye.ru/ под ключ выведет ваш сайт на вершины Google и Yandex. Анализ конкурентов, глубокая оптимизация, качественные ссылки — всё для вашего бизнеса. Получите поток целевых клиентов уже сегодня!

  • Charlesjinge at 12:34 pm, February 28, 2024

    Забудьте о низких позициях в поиске! Наше SEO продвижение и оптимизация на заказ https://seosistemy.ru/ выведут ваш сайт в топ, увеличивая его видимость и привлекая потенциальных клиентов. Индивидуальный подход, глубокий анализ ключевых слов, качественное наполнение контентом — мы сделаем всё, чтобы ваш бизнес процветал.

  • Williamfes at 4:38 pm, February 28, 2024

    Дайте вашему сайту заслуженное место в топе поисковых систем! Наши услуги
    стоимость оптимизация сайта на заказ обеспечат максимальную видимость вашего бизнеса в интернете. Персонализированные стратегии, тщательный подбор ключевых слов, оптимизация контента и технические улучшения — всё это для привлечения целевой аудитории и увеличения продаж. Вместе мы поднимем ваш сайт на новый уровень успеха!

  • Williamfes at 6:55 pm, February 28, 2024

    Дайте вашему сайту заслуженное место в топе поисковых систем! Наши услуги
    заказать seo продвижение на заказ обеспечат максимальную видимость вашего бизнеса в интернете. Персонализированные стратегии, тщательный подбор ключевых слов, оптимизация контента и технические улучшения — всё это для привлечения целевой аудитории и увеличения продаж. Вместе мы поднимем ваш сайт на новый уровень успеха!

  • mpo slot terbaru at 2:31 am, February 29, 2024

    I want to to thank you for this wonderful read!! I definitely enjoyed every little bit of it.
    I have you book marked to look at new stuff you post…

  • RobertFed at 11:56 am, February 29, 2024

  •  top 10 betting sites at 9:04 pm, February 29, 2024

    Nice blog here! Also your website rather a lot up fast!
    What web host are you using? Can I am getting your affiliate link in your host?
    I desire my web site loaded up as quickly as yours lol

  • jitabet at 9:05 pm, February 29, 2024

    Appreciation to my father who stated to me concerning this weblog, this weblog is really awesome.

  • Washington DC at 9:41 pm, February 29, 2024

    Simply wish to say your article is as amazing.
    The clearness in your post is just great and i can assume you’re an expert on this subject.
    Well with your permission let me to grab your RSS feed to keep updated with forthcoming post.
    Thanks a million and please carry on the enjoyable work.

  • Rhine River Cruising at 11:41 pm, February 29, 2024

    Howdy! I could have sworn I’ve been to this site before but
    after browsing through some of the post I realized it’s new to me.
    Anyhow, I’m definitely glad I found it and I’ll be book-marking and
    checking back frequently!

  • cảm ứng air 1 at 5:12 am, March 2, 2024

    Hi there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get
    my blog to rank for some targeted keywords but I’m not
    seeing very good results. If you know of any please share.
    Thanks!

  • dewascatter link alternatif at 12:33 am, March 3, 2024

    It’s very trouble-free to find out any topic on web
    as compared to books, as I found this post
    at this web site.

  • porea at 12:43 pm, March 3, 2024

  • ManuelTiest at 4:23 pm, March 3, 2024

  • ArthurCal at 7:08 pm, March 3, 2024

  • gsnslot daftar at 9:33 pm, March 3, 2024

    Your mode of explaining the whole thing in this piece
    of writing is genuinely nice, every one can effortlessly know it, Thanks a lot.

  • HermanDesty at 2:38 pm, March 4, 2024

  • RobertBog at 11:22 am, March 5, 2024

  • Jeffreytriaw at 1:05 pm, March 5, 2024

  • RogerNaw at 2:26 pm, March 5, 2024

  • Elmeroppop at 3:49 pm, March 5, 2024

  • BernardDioto at 10:36 pm, March 5, 2024

  • Thomasautok at 2:10 am, March 6, 2024

  • HeathCat at 3:33 am, March 6, 2024

  • AndrewLoyax at 4:58 am, March 6, 2024

  • HowardSitly at 6:29 am, March 6, 2024

  • JamesClusy at 8:26 am, March 6, 2024

  • WilliamWounk at 10:39 am, March 6, 2024

  • dewa scatter at 11:56 am, March 6, 2024

    In fact no matter if someone doesn’t know afterward its up to other
    users that they will assist, so here it occurs.

  • Jamesnoinc at 12:02 pm, March 6, 2024

  • link mpo slot at 5:15 pm, March 7, 2024

    I like the valuable information you provide in your articles.

    I will bookmark your weblog and check again here frequently.

    I’m quite sure I will learn lots of new stuff right here! Good luck for the next!

  • dewascatter link alternatif at 3:35 pm, March 8, 2024

    Hello, the whole thing is going sound here and ofcourse every one is
    sharing data, that’s in fact good, keep up writing.

  • dewa scatter at 11:03 pm, March 8, 2024

    You are so interesting! I do not think I’ve truly read a single thing
    like this before. So wonderful to find somebody with genuine thoughts
    on this subject matter. Seriously.. many thanks for starting this up.
    This site is one thing that is needed on the internet,
    someone with some originality!

  • Adele at 12:45 pm, March 12, 2024

    I read this paragraph fully about the resemblance of hottest and earlier technologies, it’s amazing article.

  • link mpo slot at 9:02 pm, March 12, 2024

    I am sure this post has touched all the internet viewers, its
    really really pleasant piece of writing on building up new webpage.

  • 카지노사이트 at 8:14 pm, March 17, 2024

    Your blog is beautiful, helpful posts, are you tired of posting and the income has been coming for a long time and no one is visiting? here you can really earn without getting tired, this is the online casino that will help you.
    https://main7.top/

  • RichardSof at 11:35 pm, March 17, 2024

  • Darrickger at 10:19 am, March 18, 2024

  • Waltertox at 1:04 pm, March 18, 2024

  • Matthewkneen at 4:45 pm, March 18, 2024

  • Louistwere at 3:29 am, March 19, 2024

  • Aaronexina at 8:16 am, March 19, 2024

  • Scottgex at 10:51 am, March 19, 2024

  • MartinAmubs at 2:34 pm, March 19, 2024

  • Daviddauts at 5:12 pm, March 19, 2024

  • BobbyRhilm at 2:02 am, March 20, 2024

  • BobbyRhilm at 3:59 am, March 20, 2024

  • BobbyRhilm at 7:13 am, March 20, 2024

  • BobbyRhilm at 9:38 am, March 20, 2024

  • BobbyRhilm at 12:11 pm, March 20, 2024

  • BobbyRhilm at 2:45 pm, March 20, 2024

  • EmorySmerm at 6:12 pm, March 20, 2024

  • Anthonyskync at 3:58 am, March 21, 2024

  • JasperAnymn at 5:59 am, March 21, 2024

  • Waltertew at 8:59 am, March 21, 2024

    В нашем кинотеатре https://hdrezka.uno смотреть фильмы и сериалы в хорошем HD-качестве можно смотреть с любого устройства, имеющего доступ в интернет. Наслаждайся кино или телесериалами в любом месте с планшета, смартфона под управлением iOS или Android.

  • JamesEvowl at 11:24 am, March 21, 2024

  • JosephSib at 2:18 pm, March 21, 2024

  • Carltonbab at 7:14 am, March 22, 2024

  • Williamheids at 8:58 am, March 22, 2024

  • HowardEnupe at 11:07 am, March 22, 2024

    https://t.me/crypto_signals_binance_pump/24498/ Standard Price for VIP- membership for 1 Week VIP Membership is 0.0014 BTC, You will do send payment to BTC address 1KEY1iKrdLQCUMFMeK4FEZXiedDris7uGd Discounted price may be different from 0.00075 to 0.00138 BTC, that is why follow to all announces published in our Public channel!

  • DanielCheni at 12:47 pm, March 22, 2024

  • MitchelRot at 2:47 pm, March 22, 2024

  • WilliamHix at 4:14 pm, March 22, 2024

  • Lonnietob at 5:02 am, March 23, 2024

  • FrankFlabs at 7:04 am, March 23, 2024

  • Ronaldtub at 8:56 am, March 23, 2024

    Услуга демонтажа старых частных домов и профессионального вывоза мусора в Москве и Московской области от нашей компании. Мы осуществляем свою деятельность в указанном регионе и предлагаем услугу демонтаж дачного дома по доступным ценам. Наши специалисты гарантируют выполнение работ в течение 24 часов после оформления заказа.

  • AllenBen at 10:41 am, March 23, 2024

    Услуга по демонтажу старых домов и вывозу мусора в Москве и МО. Компания предоставляет услуги по демонтажу старых зданий и вывозу мусора на территории Москвы и Московской области. Услуга сколько стоит снести дом выполняется опытными специалистами в течение 24 часов после оформления заказа. Перед началом работ наш специалист бесплатно выезжает на объект для оценки объема работ и консультации.

  • MorrisTef at 1:31 pm, March 23, 2024

  • Bouncy Castle Hire at 5:25 pm, March 23, 2024

    It’s remarkable in favor of me to have a website, which is
    helpful for my know-how. thanks admin

  • Larrygof at 9:23 pm, March 23, 2024

    Услуга демонтажа старых частных домов и вывоза мусора в Москве и Подмосковье от нашей компании. Мы предлагаем демонтаж и вывоз мусора в указанном регионе по доступным ценам. Наша команда https://hoteltramontano.ru гарантирует выполнение услуги в течение 24 часов после заказа. Мы бесплатно оцениваем объект и консультируем клиентов. Узнать подробности и рассчитать стоимость можно по телефону или на нашем сайте.

  • MichaelBainc at 7:39 am, March 24, 2024

  • CurtisNah at 11:15 am, March 24, 2024

  • CurtisNah at 1:45 pm, March 24, 2024

  • vpn special coupon at 3:16 pm, March 25, 2024

    What’s Going down i am new to this, I stumbled upon this I have discovered It positively useful and
    it has helped me out loads. I hope to give a contribution & help different customers like its aided me.
    Good job.

    my web-site: vpn special coupon

  • Dustinknilm at 4:36 pm, March 25, 2024

    Лучшие картинки различных тематик https://stilno.site

  • vpn special at 8:21 pm, March 25, 2024

    Very nice blog post. I certainly love this site. Thanks!

    Stop by my web page; vpn special

  • LanceVeivy at 12:43 am, March 26, 2024

  • StevenHaf at 9:59 am, March 26, 2024

    Уникальные фото различных тематик https://pro-dachnikov.com

  • RaymondIteve at 6:01 am, March 27, 2024

  • james at 7:03 am, March 27, 2024

  • jane at 7:04 am, March 27, 2024

  • jason at 7:05 am, March 27, 2024

  • jason at 7:06 am, March 27, 2024

  • jack at 7:07 am, March 27, 2024

  • jackson at 7:09 am, March 27, 2024

  • Anthonycauff at 8:07 am, March 27, 2024

  • TimothyLop at 10:44 am, March 27, 2024

  • TimothyLop at 1:30 pm, March 27, 2024

    Ищете профессиональных грузчиков, которые справятся с любыми задачами быстро и качественно? Наши специалисты обеспечат аккуратную погрузку, транспортировку и разгрузку вашего имущества. Мы гарантируем грузчики город самара, внимательное отношение к каждой детали и доступные цены на все виды работ.

  • TimothyLop at 2:11 pm, March 27, 2024

    Ищете профессиональных грузчиков, которые справятся с любыми задачами быстро и качественно? Наши специалисты обеспечат аккуратную погрузку, транспортировку и разгрузку вашего имущества. Мы гарантируем услуги грузчиков в самаре, внимательное отношение к каждой детали и доступные цены на все виды работ.

  • TimothyLop at 3:45 pm, March 27, 2024

  • TimothyLop at 4:25 pm, March 27, 2024

Leave a comment

Let's Discuss Your Project

Get free consultation and let us know your project idea to turn
it into an amazing digital product.

Let’s talk

NEWS & BLOG

Related Blogs

Digital Transformations Re-Engineering for Success for the 21st Century

Big Data Apr 25th, 2017

Digital Transformations Re-Engineering for Success for ...

Read more
Auto Backup MongoDB Database with NodeJS on server

Big Data Jan 13th, 2017

Auto Backup MongoDB Database with NodeJS on server...

Read more
Glimpses into Technologies Used in Euro Cup, 2016

Big Data Jun 13th, 2016

Glimpses into Technologies Used in Euro Cup, 2016...

Read more

INQUIRY

Let's get in touch

UNITED STATES

31236 Meadowview Square,
Delmar, DE 19940, USA

Sales: +1 667 771 6758

UNITED KINGDOM

13 Layton Road, Hounslow,
London, TW3 1YJ

Sales: +44 7404 607567

INDIA

2nd Floor, Sun Avenue One, Bhudarpura, Ayojan Nagar, Nr. Shyamal Cross Road, Ahmedabad, Gujarat-380006

Sales: +91 635-261-6164

For Project Inquiries

biolah

hariantulis

depo 25 bonus 25

depo 25 bonus 25

mndrmndr.com

bonusdeposit.net

https://www.greentourstanzania.com/wp-includes/customize/

https://temp1.novotest.biz/id/

depo 25 bonus 25

https://sumberjo-blitar.desa.id/images

https://sumberjo-blitar.desa.id/data

depo 25 bonus 25 to 5x

depo 25 bonus 25

https://www.greentourstanzania.com/wp-includes/js/product/

https://smpabbs.sch.id/gacor/100/

https://smpabbs.sch.id/gacor/bonus/

deposit 25 bonus 25

depo 25 bonus 25

bonus new member 100

https://ppdb.smk-kosgoro.sch.id/data/depo 25 bonus 25https://jesus.nouvellevie.com/wp-includes/images/Getoko.iddepo 25 bonus 25https://bonus-baru.s3.ap-southeast-1.amazonaws.com/link-daftar-slot-gacor.htmlhttps://bonus-baru.s3.ap-southeast-1.amazonaws.com/scatter-pink-paling-gacor.htmlhttps://worldlisteningproject.org/wp-includes/depo25bonus25/bonus new member 100