Step 1:
sudo apt-get install gnupg
Result:
root@tutorialspots:~# sudo apt-get install gnupg Reading package lists... Done Building dependency tree Reading state information... Done gnupg is already the newest version (2.2.19-3ubuntu2.1). 0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
Step 2:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
Step 3:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
Step 4:
sudo apt-get update
Result:
root@tutorialspots:~# sudo apt-get update Hit:1 http://mirror.hetzner.de/ubuntu/packages focal InRelease Hit:2 http://mirror.hetzner.de/ubuntu/packages focal-updates InRelease Hit:3 http://mirror.hetzner.de/ubuntu/packages focal-backports InRelease Hit:4 http://mirror.hetzner.de/ubuntu/packages focal-security InRelease Hit:5 http://archive.ubuntu.com/ubuntu focal InRelease Get:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Hit:8 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease Hit:9 https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease Get:10 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB] Hit:7 https://downloads.mariadb.com/Tools/ubuntu focal InRelease Get:11 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Ign:12 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease Get:14 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release [4,406 B] Hit:13 https://downloads.mariadb.com/MaxScale/2.5.15/apt focal InRelease Get:15 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release.gpg [801 B] Get:16 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 Packages [6,548 B] Get:17 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse arm64 Packages [6,291 B] Fetched 346 kB in 2s (157 kB/s) Reading package lists... Done
Step 5:
Install the MongoDB packages:
sudo apt-get install -y mongodb-org
Result:
root@tutorialspots:~# sudo apt-get install -y mongodb-org Reading package lists... Done Building dependency tree 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 10 not upgraded. Need to get 147 MB of archives. After this operation, 449 MB of additional disk space will be used. Get:1 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-database-tools amd64 100.5.0 [46.5 MB] Get:2 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-mongosh amd64 1.0.5 [41.6 MB] Get:3 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-shell amd64 5.0.2 [14.3 MB] Get:4 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-server amd64 5.0.2 [26.5 MB] Get:5 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-mongos amd64 5.0.2 [18.1 MB] Get:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-database-tools-extra amd64 5.0.2 [7,752 B] Get:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-database amd64 5.0.2 [3,536 B] Get:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org-tools amd64 5.0.2 [2,892 B] Get:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0/multiverse amd64 mongodb-org amd64 5.0.2 [2,928 B] Fetched 147 MB in 6s (25.9 MB/s) Selecting previously unselected package mongodb-database-tools. (Reading database ... 57501 files and directories currently installed.) Preparing to unpack .../0-mongodb-database-tools_100.5.0_amd64.deb ... Unpacking mongodb-database-tools (100.5.0) ... Selecting previously unselected package mongodb-mongosh. Preparing to unpack .../1-mongodb-mongosh_1.0.5_amd64.deb ... Unpacking mongodb-mongosh (1.0.5) ... Selecting previously unselected package mongodb-org-shell. Preparing to unpack .../2-mongodb-org-shell_5.0.2_amd64.deb ... Unpacking mongodb-org-shell (5.0.2) ... Selecting previously unselected package mongodb-org-server. Preparing to unpack .../3-mongodb-org-server_5.0.2_amd64.deb ... Unpacking mongodb-org-server (5.0.2) ... Selecting previously unselected package mongodb-org-mongos. Preparing to unpack .../4-mongodb-org-mongos_5.0.2_amd64.deb ... Unpacking mongodb-org-mongos (5.0.2) ... Selecting previously unselected package mongodb-org-database-tools-extra. Preparing to unpack .../5-mongodb-org-database-tools-extra_5.0.2_amd64.deb ... Unpacking mongodb-org-database-tools-extra (5.0.2) ... Selecting previously unselected package mongodb-org-database. Preparing to unpack .../6-mongodb-org-database_5.0.2_amd64.deb ... Unpacking mongodb-org-database (5.0.2) ... Selecting previously unselected package mongodb-org-tools. Preparing to unpack .../7-mongodb-org-tools_5.0.2_amd64.deb ... Unpacking mongodb-org-tools (5.0.2) ... Selecting previously unselected package mongodb-org. Preparing to unpack .../8-mongodb-org_5.0.2_amd64.deb ... Unpacking mongodb-org (5.0.2) ... Setting up mongodb-mongosh (1.0.5) ... Setting up mongodb-org-server (5.0.2) ... Adding system user `mongodb' (UID 116) ... Adding new user `mongodb' (UID 116) with group `nogroup' ... Not creating home directory `/home/mongodb'. Adding group `mongodb' (GID 120) ... Done. Adding user `mongodb' to group `mongodb' ... Adding user mongodb to group mongodb Done. Setting up mongodb-org-shell (5.0.2) ... Setting up mongodb-database-tools (100.5.0) ... Setting up mongodb-org-mongos (5.0.2) ... Setting up mongodb-org-database-tools-extra (5.0.2) ... Setting up mongodb-org-database (5.0.2) ... Setting up mongodb-org-tools (5.0.2) ... Setting up mongodb-org (5.0.2) ... Processing triggers for man-db (2.9.1-1) ...
Step 6:
sudo systemctl enable mongod
Step 7:
sudo systemctl start mongod
Done!
You can install compass:
install_compass
Result:
root@123:~# install_compass Retrieving the Compass package from https://compass.mongodb.com/api/v2/download/latest/compass/stable/linux_deb Complete!ng ... 100% Download complete! Installing the package... Cleaning up... Done! A log file for this installation can be found at /tmp/install_compass.log