Watch Youtube Video (HINDI) :
Here is some easy step to Install MongoDB In Ubuntu In this post, we will install the MongoDB server on the Ubuntu server. MongoDB is a free and open source NoSQL Database Server that provides a high-performance and schema-free documentation-oriented database server that can be used to create your powerful website and applications with a strong database server.
We will install mongo shell on ubuntu, There are many database popular databases available in the market, The MongoDB is a powerful database server, this is a non-SQL database server. This makes your site database very secure and stores large users' data on the server. MongoDB is a popular database server among all the databases in the available market.
The MongoDB packages are already included in Ubuntu default repositories, however, the version of the MongoDB is not the latest already provided by you. So in this case you must be required to update that version. To install the Latest MongoDB version on Ubuntu Linux this tutorial will show you how. as well as for new users learning installation will be helpful.
For the install MongoDB In Ubuntu server we need to follow some basic command step by step, So let's start how to install mongodb ubuntu.
Installation
First, We will update the packages list to having to get the most recent version of the repository listings.
$ sudo apt update
Now, We will install the MongoDB package itself.
$ sudo apt install -y mongodb
After we will check the service's status.
$ sudo systemctl status mongodb
Based on service status we will run the below-suggested command. Below is provided stop, start and restart MongoDB Server.
$ sudo systemctl stop mongodb $ sudo systemctl start mongodb $ sudo systemctl restart mongodb
By default, the MongoDB server is configured to start automatically with the Ubuntu server. If you want to disable automatic startup, run the below-given command.
$ sudo systemctl disable mongodb
Install PostgreSQL Ubuntu 20.04 With pgAdmin4
else you need to enable it again.
$ sudo systemctl enable mongodb
Change Port and External Access Permission
After installing MongoDB in the Ubuntu server, The database server default runs on port 27017 and you can only access your MongoDB server itself.
If you want to access the External Ip address for the MongoDB server, You need to do it with UFW. The UFW is a default firewall In the ubuntu server. In this server section, So we just need to allow the port to get access external Ip address of your server. I will show you how to configure UFW as well as How to allow External access to MongoDB.
$ sudo ufw status
If the status is below :
$ Status: inactive
Enable UFW using the below-provided command and open the SSH port firstly if you are connected by SSH:
$ sudo ufw allow ssh $ sudo ufw enable
Before you proceed next step, Just for more security reasons If you want to allow your port for a specific Ip address you can also define your IP address with the given port. For this reason, your database server will be more secure, This will give access to who register their IP address with your MongoDB server with a given port.
In this case, use the below-given command and add your Ip address in this, and hit the command in your terminal.
$ sudo ufw allow from {YOUR IP ADDRESS} to any port 27017
If you want to access port 27017 for all the Users, there is no matter which Ip entered as well as the local network also in your system you can use the below-given command. This command will allow to access all the users.
$ sudo ufw allow 27017
Now check again your firewall UFW status.
$ sudo ufw status
Register IP With Port
The MonGo Db server listens to localhost by default, to make the database accessible from outside any server, we have to reconfigure it to listen on the server Ip address also.
/etc/mongod.conf$ sudo nano /etc/mongod.conf
Add all Ip addresses in the server-given file like the below-given example in which you want to access the External Ip address.
# network interfaces net: port: 27017 bindIp: 127.0.0.1,143.42.41.52 // YOUR ALL IP ADDRESS WHICH YOU WANT TO ALLOW
Now, all the setups are done, We will restart the MongoDB server to apply all the changes.
$ sudo systemctl daemon-reload $ sudo service mongod restart
We always thanks to you for reading our blogs.

Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us

Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Command SSH key generate in ubuntu server
- cPanel Cron Job Example With Demo
- MongoDB Database Installation
- SOLVED # 1118 Row size too large 8126. Changing some columns to TEXT or BLOB
- ERROR: database "laravel" is being accessed by other users DETAIL: There is 1 other session using the database.
- How To Install MongoDB In Ubuntu
- MongoDB Database Connection In Laravel
- How to See Pgsql Database List in Ubuntu
- [FIXED] Unknown Collation: utf8mb4_0900_ai_ci In MYSQL
- Error :unable to connect to server connection to the server at port 5432 failed timeout expired