Overview
Installation of MongoDB involves several steps, such as choosing whether to use community or commercial versions, downloading package with wrote repository and sign before on Ubuntu, setting up replica sets (if required), and verifying the installation with a connection test. In that instruction we will consider installation for Ubuntu.
Warning! Commonly in repositories actively distribute package with label mongodb, which don't maintained by official developer! Instead of that we will add official repository and download mongodb-org. If you already have installed mongodb unofficial package, than you have to purge them from the system by entering command:
After that command package with dependencies will be deleted!
Installation
First of all we need to make sure that we use latest version of package in the system:
Than, let's talk about how we will securely download package. For that Linux use official repository and open realisation of pgp sign! If you don't have that package, than install it:
Check version of using OS:
Download public key which allowed us to confirm authenticity and integrity of transfer data from insecure network:
gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
That command prefer to use from user with administrative privileges or use command sudo. In our case we use root, therefore command without sudo. In the previous action we downloaded pgp-key and add them into the trusted sign. Then we need to create list in the repository:
Add repository with sign in the file like in the command below:
Insert in that file row below:
We indicate architecture, sign and URL address therefore we need to update indexes:
Next we need to install package from repository, by using apt manager, for download the latest version:
If you want to download dedicated version of MongoDB, than you can type:
That command line help to download dedicated version but don't save from unexpected update, that can be useful in the situations when new version unsuitable, than we need to setup status of packet:
Option --set-selections help to indicate status of package, that can be install, deinstall or hold. In the official package there is configuration file that we can modify:
Now we need to start daemon in the initialisation system we will use command:
Then check the loading of daemon typing command before:
Alright! Now we need to start MongoSH, that can help to manage DB server:
All process involves several crucial steps to ensure a secure and reliable setup. The decision between community and commercial versions, proper repository selection, and attention to package authenticity are fundamental considerations. Notably, caution is advised against using unofficial MongoDB packages distributed in certain repositories, as these may lack official maintenance and support.