How to install MongoDB 5.0 on Ubuntu 21.04
To Install MongoDB 5.0 on Ubuntu 21.04
Introduction:
The MongoDB database program is a document-oriented database, which refers to a program and storage system for storing, retrieving, and managing document-oriented information.
Installation Procedure:
Step 1: Check the installed OS version by using the following command
linuxhelp@linuxhelp:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Step 2: Log in as Root user by using the following command
linuxhelp@linuxhelp:~$ sudo -s
[sudo] password for linuxhelp:
Step 3: Change to the home directory by using the following command
root@linuxhelp:/home/linuxhelp# cd ~
Step 4: Add the MongoDB repository key to add repository with apt.
root@linuxhelp:~# curl -Ss https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Step 5:Add the MongoDB repository to the APT source list by using the following command
root@linuxhelp:~# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse
Step 6: Update the APT source list by using the following command
root@linuxhelp:~# apt update
Ign:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu hirsute InRelease
Get:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release [4,406 B]
Get:4 http://in.archive.ubuntu.com/ubuntu hirsute-updates InRelease [115 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu hirsute-backports InRelease [101 kB]
Get:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release.gpg [801 B]
Get:7 http://security.ubuntu.com/ubuntu hirsute-security InRelease [110 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main i386 Packages [202 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [406 kB]
Get:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages [8,359 B]
Get:11 http://in.archive.ubuntu.com/ubuntu hirsute-updates/main amd64 DEP-11 Metadata [95.1 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu hirsute-updates/universe i386 Packages [237 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 Packages [329 kB]
Get:14 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse arm64 Packages [7,686 B]
Get:15 http://in.archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 DEP-11 Metadata [57.9 kB]
Get:16 http://in.archive.ubuntu.com/ubuntu hirsute-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:17 http://security.ubuntu.com/ubuntu hirsute-security/main amd64 DEP-11 Metadata [9,672 B]
Get:18 http://in.archive.ubuntu.com/ubuntu hirsute-backports/universe amd64 DEP-11 Metadata [9,348 B]
Get:19 http://security.ubuntu.com/ubuntu hirsute-security/universe amd64 DEP-11 Metadata [5,684 B]
Fetched 1,700 kB in 2s (832 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
262 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 7: Install the MongoDB by using the following command
root@linuxhelp:~# apt install mongodb-org
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
mongodb-database-tools mongodb-mongosh mongodb-org-database mongodb-org-database-tools-extra mongodb-org-mongos
mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-database-tools mongodb-mongosh mongodb-org mongodb-org-database mongodb-org-database-tools-extra
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 9 newly installed, 0 to remove and 262 not upgraded.
Need to get 147 MB of archives.
After this operation, 464 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-database-tools amd64 100.5.1 [46.5 MB]
Get:2 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-mongosh amd64 1.1.1 [42.0 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-shell amd64 5.0.3 [14.3 MB]
Get:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-server amd64 5.0.3 [26.4 MB]
Get:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-mongos amd64 5.0.3 [18.2 MB]
Get:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-database-tools-extra amd64 5.0.3 [7,752 B]
Get:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-database amd64 5.0.3 [3,540 B]
Step 8: Check the status of MongoDB by using the following command
root@linuxhelp:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: https://docs.mongodb.org/manual
Step 9: Start the MongoDB by using the following command
root@linuxhelp:~# systemctl start mongod
Step 9: Enable the MongoDB to start on boot
root@linuxhelp:~# systemctl enable mongod
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /lib/systemd/system/mongod.service.
Step 10: Check the version of MongoDB by using the following command
root@linuxhelp:~# mongo --version
MongoDB shell version v5.0.3
Build Info: {
"version": "5.0.3",
"gitVersion": "657fea5a61a74d7a79df7aff8e4bcf0bc742b748",
"openSSLVersion": "OpenSSL 1.1.1j 16 Feb 2021",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
By this to install MongoDB 5.0 on Ubuntu 21.04
Comments ( 0 )
No comments available