How to install ONLYOFFICE Desktop Editors in Ubuntu?

install OnlyOffice in Ubuntu

ONLYOFFICE is a free and open-source office suite developed by Ascensio System SIA. It includes online editors and a range of productivity and collaboration tools, chat, email, and project management tools. The ONLYOFFICE desktop editors comprised text documents, spreadsheets, and presentations in a single package. Using ONLYOFFICE desktop editors have their own benefits. Here we … Read more

How to install MongoDB in Fedora?

MongoDB is a cross-platform, source available, document database. It is classified as a No SQL database and uses JSON-like documents with dynamic schemas that means like a relational database it does not requires predefined schemas for entering data in the database. MongoDB is developed by MongoDB Inc and licensed under the SSPL (Server Side Public License). In this … Read more

How to install uTorrent in Ubuntu?

install utorrent in ubuntu

μTorrent or uTorrent is among one of the most popular BitTorrent clients. It is a proprietary, adware BitTorrent client which is owned by Rainberry Inc. The letter μ in its name refers to the small memory footprint of this application. In this article, I will discuss how to install and use μTorrent in Ubuntu. The … Read more

How to install PostgreSQL in Ubuntu?

Install postgresql in Ubuntu

PostgreSQL or Postgres is a free and open-source relational database management system. It is a robust, extensible, and technical standard-compliant database management system. PostgreSQL is a successor of the Ingres database which is developed at UC Berkley in 1996. It is designed to handle from simple to more complex tasks and can be used on … Read more

How to install Transmission in Ubuntu?

Install Transmission in Ubuntu

Transmission is a lightweight, free BitTorrent client which comes pre-installed with many Linux distributions. You can download some content using Transmission by opening the torrent file ( a file with .torrent extension ) or magnet link provided by the creator. By default, it doesn’t come installed in Ubuntu but can be downloaded using the official … Read more

How to install and use GDebi in Ubuntu?

install gdebi in Ubuntu

There are different ways such as the dpkg command, Ubuntu software(default), etc to install a .deb package in Ubuntu and distributions based on it. GDebi is one of them this is fast and uses fewer resources as compared to Ubuntu software. GDebi is a simple tool used for installing local deb packages. It resolves and … Read more

How to install DVBlast in Ubuntu?

Streaming is the method of delivering content where media content is produced and consumed continuously. It is most prevalent in video on demand and television services. This whole thing is performed with the help of some streaming application. DVBlast is one of them I will discuss how to install it in the Ubuntu system. DVBlast- … Read more

How to install VLC in Ubuntu?

install vlc in ubuntu

VLC is a free, open-source, and cross-platform media player. It is one of the most popular media players that supports various videos and audio formats it is capable of streaming media from a URL. VLC is developed under the VideoLAN project. In this article, I will discuss how to install VLC in Ubuntu. You can … Read more

How to install MongoDB in Ubuntu?

MongoDB is a cross-platform, source available, document database. It is classified as a No SQL database and uses JSON-like documents with dynamic schemas that means like a relational database it does not requires predefined schemas for entering data in the database.

MongoDB is developed by MongoDB Inc and licensed under the SSPL (Server Side Public License).

In this article, I will discuss how to install MongoDB in Ubuntu.

Prerequisites

You should have access to a user account with root user privileges to install required packages.

Installing MongoDB in Ubuntu

MongoDB is available in the default repository of Ubuntu but installing from it you may get a relatively older software. So we will install MongoDB from ifs official repository.

Add official MongoDB repository

First, use the given command to import the public GPG key for the latest stable version of MongoDB –

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

Now use the given command to add the MongoDB official repository to your system –

sudo add-apt-repository 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse'

Installing MongoDB

After adding the MongoDB repository to your system run the following command to update the local package index by using –

sudo apt update

Next, run the given command to install MongoDB on your system.

sudo apt install mongodb-org -y

Start MongoDB services

Once the installation of MongoDB is completed start its services by using the following command.

sudo systemctl start mongod.service

Now you can check its status by using –

sudo systemctl status mongod

status

If you want to start the MongoDB daemon automatically when the system boots then use –

sudo systemctl enable --now mongod

Test the MongoDB installation

You can verify whether the installation is completed successfully or not, to test it connect to the MongoDB database server using the mongo tool and print the connection status by using –

mongo --eval 'db.runCommand({ connectionStatus: 1 })'

If everything is set up correctly you should see the output as given in the image below.

verify installation mongodb

Enable security settings

Most of the settings are sufficient to use the MongoDB on your system but if you are using it in a production environment then you should enable the security settings from the /etc/mongod.confconfiguration file.

To enable it open this configuration file using the following command –

sudo nano /etc/mongod.conf

When the configuration file opens just add the following given lines.

security:
        authorization: enabled

As you can see in the image below.

mongodb configuration

Save this file by pressing ctrl+s and then exit from the editor using ctrl+x.

Restart the MongoDB services to make the changes effective.

sudo systemctl restart mongod

Create MongoDB root user and password

After enabling the authentication, you can create a MongoDB root user to manage the MongoDB instance.

To create new user first access the mongo shell by using –

mongo

The mongo shell will look something as given in the image below.

mongo shell

Next, use the given command to switch to the admin database.

use admin

When switched to db admin use the following command to create root user –

db.createUser({user:"root", pwd:"*#[email protected]", roles:[{role:"root", db:"admin"}]})

You will see the given output in your shell.

create user output

Now use the given command to exit from the mongo shell –

exit

You can log in to shell as root user by using a command like it is given below –

mongo -u root -p --authenticationDatabase admin

This will ask you to enter the password of the root user, enter it. This will bring you to the mongo shell.

You can see the list of users in the admin database by using –

use admin

And then use –

show users

show db users

Conclusion

You have successfully installed MongoDB on your Ubuntu system. For more information, you can read the official MongoDB documentation.

For any other query write us in the comments below.