How to install MongoDB 6 on Ubuntu 22.04 LTS Linux

ProgrammingKnowledge
1 May 202314:55

Summary

TLDRThis tutorial video guides viewers through installing MongoDB on Ubuntu 22.04. It begins with downloading the MongoDB Community Server from the official website, followed by installation using the terminal. The video then demonstrates starting the MongoDB service and checking its status. Additionally, it covers installing MongoDB Shell for command-line access and MongoDB Compass for a graphical user interface. The tutorial concludes with basic operations like creating databases and collections and inserting data, showcasing the ease of working with MongoDB on Ubuntu.

Takeaways

  • 🌐 Start by opening a browser and searching for 'download MongoDB' from the official website.
  • 🔗 Click on the 'MongoDB Community Server Download' link to access the download page.
  • 📚 Choose the latest version of MongoDB Community Server available for download at the time of the video.
  • 🖥️ Select the appropriate platform, specifically Ubuntu 22.04, to download the server package.
  • 📥 Download the .deb file for MongoDB server, which is not a large file and should download quickly.
  • 📁 Navigate to the Downloads folder to locate the downloaded MongoDB server .deb file.
  • 💻 Use the terminal to execute the .deb file with the command 'sudo dpkg -i' followed by the file name.
  • 🔓 Provide your Ubuntu password when prompted to initiate the installation of MongoDB.
  • 🛠️ After installation, use 'systemctl' commands to check the status and start the MongoDB service.
  • 🔄 Ensure MongoDB service is active and running by checking its status with 'systemctl status mongod'.
  • 🛠️ Install MongoDB shell and MongoDB Compass, both available as .deb files from the official website.
  • 📝 Use the MongoDB shell to connect to the server and perform operations like creating databases and collections.
  • 🖼️ MongoDB Compass is a GUI client that allows for visual interaction with MongoDB, including database and collection management.

Q & A

  • What is the purpose of the video?

    -The purpose of the video is to demonstrate how to install MongoDB on an Ubuntu operating system.

  • Where can I find the MongoDB Community Server download link?

    -You can find the MongoDB Community Server download link on the official MongoDB website, mongodb.com, by searching for 'download MongoDB'.

  • What is the current version of MongoDB mentioned in the video?

    -The current version of MongoDB mentioned in the video is 6.0.5.

  • Which platform is the video focused on for downloading MongoDB?

    -The video is focused on downloading MongoDB for Ubuntu 22.04.

  • What file format is downloaded for the MongoDB installation?

    -The MongoDB installation file is downloaded as a .deb file.

  • How do you navigate to the downloads folder in the terminal?

    -You navigate to the downloads folder in the terminal by typing 'cd Downloads' and pressing enter.

  • What command is used to install the MongoDB .deb file?

    -The command used to install the MongoDB .deb file is 'sudo dpkg -i' followed by the file name.

  • How can you check the status of the MongoDB service after installation?

    -You can check the status of the MongoDB service by using the command 'sudo systemctl status mongod'.

  • What command is used to start the MongoDB service?

    -The command used to start the MongoDB service is 'sudo systemctl start mongod'.

  • Where can you find MongoDB Shell and MongoDB Compass for download?

    -You can find MongoDB Shell and MongoDB Compass for download on the MongoDB website under the 'Products' and then 'Community Edition' section.

  • How do you connect to the MongoDB server using the shell?

    -You connect to the MongoDB server using the shell by typing 'mongo' in the terminal, which should automatically connect to the default MongoDB server running on localhost.

  • What is the procedure for installing MongoDB Compass?

    -The procedure for installing MongoDB Compass is similar to installing the MongoDB server: download the .deb file, navigate to the downloads folder, and use the command 'sudo dpkg -i' followed by the file name.

  • How can you view your MongoDB data using a graphical user interface?

    -You can view your MongoDB data using a graphical user interface by installing and opening MongoDB Compass, then connecting to your local MongoDB server.

Outlines

00:00

💻 Installing MongoDB on Ubuntu

This paragraph provides a step-by-step guide on how to install MongoDB on an Ubuntu operating system. It begins with the process of downloading the MongoDB Community Server from the official website, selecting the appropriate version and platform. The user is then guided to execute the downloaded .deb file using terminal commands, including navigating to the downloads folder and using 'sudo dpkg -i' to install the server. After installation, the status of the MongoDB service is checked and the service is started using 'systemctl' commands. The paragraph concludes with a brief mention of checking the MongoDB service status to confirm it is running.

05:02

🔍 Exploring MongoDB Shell and Compass

The second paragraph delves into connecting to the MongoDB server and interacting with it. It introduces the MongoDB shell, a command-line interface, and MongoDB Compass, a graphical user interface. The user is guided to download and install both the shell and Compass from the MongoDB website, detailing the selection process for the appropriate version and platform. The paragraph explains how to use the shell to connect to the server, list databases, create a new database, and insert data into a collection. It also covers the installation and basic usage of MongoDB Compass, including connecting to the server, viewing databases and collections, and creating new collections.

10:04

🛠️ Advanced MongoDB Compass Usage

The final paragraph focuses on advanced features of MongoDB Compass, such as creating databases and collections with ease. It describes the process of installing MongoDB Compass from the official website, including selecting the stable version and the appropriate package format for the user's operating system. The installation process is similar to that of the MongoDB shell, using terminal commands. Once installed, the paragraph explains how to launch MongoDB Compass, connect to the MongoDB server, and interact with the databases and collections. It also demonstrates how to create a new collection and mentions the introduction of time series collections in MongoDB 5, concluding with the creation of a new database using the Compass interface.

Mindmap

Keywords

💡MongoDB

MongoDB is a popular NoSQL database management system that stores data in a document-oriented format. It is known for its high performance, scalability, and flexibility. In the video's context, MongoDB is the main subject, with the focus on how to install it on an Ubuntu operating system. The script guides viewers through the process of downloading and installing the MongoDB Community Server.

💡Ubuntu

Ubuntu is a widely used open-source operating system based on the Linux kernel. It is known for its ease of use and strong community support. In the video, the script specifically addresses the installation of MongoDB on Ubuntu 22.04, which is the latest version at the time of the video's creation.

💡.deb file

A .deb file is a Debian package file format used by Debian and its derivatives, such as Ubuntu, for software distribution. It contains all the necessary files and metadata for the installation of a software package. In the script, the MongoDB server and clients are downloaded as .deb files, which are then installed using the dpkg command.

💡Terminal

The terminal is a command-line interface for interacting with the operating system. It allows users to execute commands and manage processes. In the video, the terminal is used to navigate to the downloads folder, execute the .deb file for MongoDB installation, and start the MongoDB service.

💡Systemctl

Systemctl is a command used in Linux systems to control the systemd system and service manager, which is responsible for starting and stopping services. In the script, 'sudo systemctl' is used to check the status of the MongoDB service and to start it after installation.

💡MongoDB Shell

The MongoDB Shell is a command-line interface for interacting with MongoDB databases. It allows users to run queries, manage data, and perform administrative tasks. The script explains how to install the MongoDB Shell and use it to connect to the local MongoDB server and perform basic database operations.

💡MongoDB Compass

MongoDB Compass is a graphical user interface (GUI) client for MongoDB that allows users to interact with their databases visually. It provides a more user-friendly alternative to the command-line interface. The video script includes instructions for downloading and installing MongoDB Compass to view and manage MongoDB data.

💡Database

A database is an organized collection of data, typically stored and accessed electronically. In the context of the video, the script discusses creating a new database in MongoDB using the shell and viewing it through MongoDB Compass. The database 'myDB' is an example used in the script.

💡Collection

In MongoDB, a collection is a group of documents that typically contain similar types of information. Collections are analogous to tables in relational databases. The script demonstrates how to create a 'students' collection in the MongoDB shell and view it using MongoDB Compass.

💡Document

A document in MongoDB is a basic unit of data, similar to a row in a relational database. It is a set of key-value pairs and is stored in BSON format. The script includes an example of inserting a document with a 'name' field into the 'students' collection.

💡Time Series Collection

A time series collection in MongoDB is a specialized type of collection designed for storing time-stamped data. It is introduced in MongoDB 5.0. The script mentions this feature while discussing the creation of a new collection in MongoDB Compass, although it is not used in the example provided.

Highlights

Introduction to installing MongoDB on Ubuntu.

Opening a browser to download MongoDB from the official website.

Selecting the MongoDB Community Server for download.

Choosing the latest version of MongoDB Community Server.

Selecting the appropriate platform and package type for Ubuntu 22.04.

Downloading the .deb file for MongoDB server.

Accessing the downloaded file in the Downloads folder.

Executing the .deb file using terminal commands.

Providing Ubuntu password to initiate MongoDB installation.

Checking the status of the MongoDB service after installation.

Starting the MongoDB service using systemctl.

Verifying the active status of the MongoDB service.

Exploring the MongoDB shell and Compass as client utilities.

Downloading the MongoDB shell for command line operations.

Installing the MongoDB shell using dpkg.

Using the shell to connect to and interact with MongoDB server.

Demonstrating database and collection creation within the shell.

Installing MongoDB Compass for graphical user interface access.

Using MongoDB Compass to connect to, view, and manage databases.

Creating additional collections and databases with MongoDB Compass.

Conclusion summarizing the installation process and utility options.

Transcripts

play00:01

hey guys in this video I'm going to show

play00:03

you how you can install

play00:05

mongodb on your Ubuntu operating system

play00:07

so let's get started and let's see how

play00:10

we can do it

play00:11

so first of all open your browser and

play00:14

search for download mongodb

play00:17

and the first link which will appear

play00:20

here will be from mongodb.com

play00:23

and here you can see mongodb Community

play00:26

server download

play00:28

link right so we want to download the

play00:33

community server for mongodb so just

play00:36

click on this link

play00:39

which is going to open this website so

play00:41

once you are on this mongodb Community

play00:45

Edition web page you can scroll down a

play00:49

little and you will see mongodb

play00:51

Community server download

play00:53

I'm going to scroll down and here you

play00:57

will be able to see the version

play00:59

so you can download the latest version

play01:02

from here the current version at the

play01:03

time of making this video is

play01:05

6.0.5 so select that version and then

play01:10

select the platform you want to download

play01:12

the mongodb for our Ubuntu

play01:15

22.04 so I'm going to select Ubuntu

play01:20

222.04 here

play01:22

and then the package is server right so

play01:25

we want to download the mongodb server

play01:28

just click on download

play01:31

which is going to download this

play01:35

mongodb.deb file so just wait for the

play01:38

download to complete it's not a big file

play01:41

so it will be downloaded really fast so

play01:44

you can see this file is downloaded

play01:48

now in order to view that file you can

play01:51

go to the files and then click on

play01:54

downloads and here you can see this

play01:57

mongodb server

play02:02

amd64.deb file right so how you can

play02:05

execute this file in order to execute

play02:07

this file you can use your terminal so

play02:11

just click on show applications icon

play02:14

here and then open your terminal by

play02:17

selecting the terminal icon or you can

play02:21

search for terminal here and then open

play02:24

the terminal from here

play02:26

and then navigate to your downloads

play02:30

folder by just typing CD

play02:33

downloads and then press enter and now

play02:37

you are in your downloads folder right

play02:40

so in order to uh run this file let me

play02:44

just LS in this directory so you can see

play02:49

all the files in that downloads folder

play02:52

directory and we want to execute this

play02:55

file which is dot Deb file right so I

play02:59

can run this dot the EB file using this

play03:01

command just write sudo

play03:04

dpkg hyphen I and the name of your file

play03:08

so you can just write M and then press

play03:12

tab it's going to auto complete the file

play03:16

name right so you can just write mongodb

play03:19

and then press Tab Key on your keyboard

play03:22

and your file name will be Auto

play03:25

completed and then press enter and give

play03:28

your ubuntu's password so I'm going to

play03:31

provide my ubuntu's password and then

play03:33

press enter

play03:34

and it's going to start the installation

play03:37

of mongodb

play03:39

so now mongodb has been installed on our

play03:43

Ubuntu operating system

play03:44

so let's see the status of mongodben if

play03:49

it's running after installing a mongodb

play03:52

so when you install mongodb you need to

play03:56

start the mongodb service in order to

play04:00

start the mongodb server right so in

play04:04

order to check the status of the mongodb

play04:07

service let's see what's the command for

play04:10

that so to check the status just write

play04:13

sudo and then system CTL so just write

play04:18

the system

play04:19

CTL

play04:21

status and then the name of your service

play04:26

in our case the name of our service will

play04:30

be d right so just press enter

play04:35

here and you can see that mongodb

play04:39

database server is there but right now

play04:43

it's inactive or dead right so we need

play04:47

to start this service so in order to

play04:49

start this service you need to write

play04:51

this command sudo systemctl

play04:54

start and then D and then press

play04:59

enter which is going to start the

play05:01

Daemon on your Ubuntu operating system

play05:05

once again you're going to check the

play05:07

status of our Daemon service and

play05:11

this time you will see that the status

play05:15

is active or running after we started

play05:19

this mongodb right so now we have

play05:22

successfully installed mongodb server

play05:25

but how you can connect to the server

play05:28

and create some databases or view the

play05:32

data inside your database for that you

play05:35

will need a utility called sh if

play05:39

you want to use the command line tool or

play05:43

you can also download some kind of

play05:46

graphical user interface client also

play05:49

which is also available on mongodb

play05:52

website

play05:53

so you can once again go to the mongodb

play05:56

website where you have downloaded the

play05:59

community version here you can select

play06:01

products and then Select Community

play06:04

Edition

play06:05

and then when you scroll down

play06:09

you have already downloaded the mongodb

play06:11

server and then when you scroll down a

play06:14

little you will see tools right

play06:17

so under Tools you can see mongodb shell

play06:22

you also have mongodb Compass which is

play06:25

the mongodb client which is the

play06:28

graphical user interface client so let's

play06:31

try to install both of these clients the

play06:34

command line client and the graphical

play06:37

user interface so let's install the

play06:40

mongodb shell first so I'm going to

play06:42

select mongodb shell select the latest

play06:45

version from here and then platform is

play06:48

Ubuntu so this is okay for me

play06:51

and then the package type is dot dep

play06:55

just click on download which is going to

play06:57

start download and you know the

play07:00

procedure so once this dot the EB file

play07:02

is downloaded we are going to go to our

play07:05

downloads folder so let me clear this

play07:09

terminal and I'm already in my downloads

play07:12

folder if you are not you can just see

play07:14

the two your downloads folder and you

play07:17

can see this sh

play07:20

dot Deb file is downloaded so the

play07:24

command for installing is same just

play07:26

write sudo

play07:28

dpkg hyphen I and the name of your

play07:32

mongodb

play07:34

dot the EB file so just right click copy

play07:38

and right click paste here and then

play07:42

press enter which is going to start the

play07:44

download of sh or shell

play07:48

just wait for some time and you can see

play07:50

shell is also installed

play07:53

once it's installed you can write this

play07:56

command which is sh to check the

play08:01

status so just write sh

play08:04

and if

play08:05

everything is working fine then this

play08:09

sh command is going to connect to

play08:13

your default mongodb server which is

play08:17

running on your Local Host right so we

play08:20

have already uh installed mongodb server

play08:24

and it's it was already running

play08:26

so this client has recognized that and

play08:30

connected to your default mongodb server

play08:34

here you can write some commands like

play08:38

show DBS

play08:42

and it's going to show all the databases

play08:45

right if you want to create a database

play08:47

you can write use

play08:49

and the name of your database for

play08:52

example my DB and it's going to create

play08:56

that database for you

play08:58

but

play09:00

you need to insert some data in your

play09:03

database

play09:04

to view this database when you give this

play09:07

show DBS command so if you give show DBS

play09:11

you will not be able to see this command

play09:14

I should have written show

play09:16

the bees here

play09:18

and you can see still I don't see my DB

play09:22

in the list

play09:23

the reason is I have to insert some data

play09:26

into my database in order to view that

play09:30

database

play09:32

so in order to create a collection you

play09:35

can write this command DB dot create

play09:39

collection right so I just need to write

play09:43

db.38 collection and then in the

play09:47

parenthesis just give the name of your

play09:49

collection I'm going to name my

play09:51

collection as

play09:53

students for example and then press

play09:56

enter

play09:57

now in order to view the collections

play09:59

inside my database I can say show

play10:03

collections here and you can see I have

play10:06

one collection which is students

play10:08

collection right

play10:09

in order to insert data I can write DB

play10:12

dot The Collection name which is

play10:17

students in my case and then insert and

play10:21

then I can give adjacent value to insert

play10:25

data into it I can so I can insert the

play10:28

data using these curly brackets and then

play10:31

I can say name

play10:35

colon

play10:37

whatever name I want to give here right

play10:40

so just insert the data using this

play10:44

command

play10:45

and once the data is inserted you can

play10:49

see when you give show DBS command you

play10:53

will be able to see my DB is there right

play10:57

so shell is working let's also

play11:01

install mongodb compass

play11:03

so once again go to the mongodb website

play11:07

and then click on product click on

play11:10

Community Edition

play11:12

and then under Tools

play11:16

you will be able to see this mongodb

play11:19

Compass here mongodb Compass which is a

play11:22

GUI I'm going to click on that and then

play11:25

here I can select the stable version and

play11:29

then select my operating system which is

play11:32

Ubuntu 64-bit and then I can select this

play11:38

package format which is dot dep right

play11:42

so just click on this download button

play11:46

which is going to download this mongodb

play11:49

Compass dot Deb file once this dot Deb

play11:53

file is downloaded the procedure for

play11:56

installing mongodb Compass is also very

play12:00

easy just CD to your downloads folder

play12:05

just give LS command to view what is the

play12:08

name of the mongodb compass dot the EB

play12:11

file you can see this is the file which

play12:13

we have downloaded

play12:15

in order to run this just write sudo

play12:19

dpkg

play12:22

hyphen I and the name of your file which

play12:24

is this one so I'm going to right click

play12:26

copy and right click paste and then

play12:29

press enter and give my ubuntu's

play12:32

password

play12:33

and then press enter which is going to

play12:36

install mongodb compass on my Ubuntu

play12:40

operating system once mongodb Compass is

play12:43

installed

play12:44

you can see I can use this command which

play12:47

is mongodb hyphen Compass or I can go to

play12:52

uh the application section so just click

play12:55

on show applications

play12:57

and here I can see this mongodb Compass

play13:00

uh icon I can also search for

play13:04

mongodb and you can see mongodb

play13:07

compasses here so just open mongodb

play13:09

compass

play13:10

uh using this uh icon

play13:14

and once mongodb Compass has been

play13:17

started

play13:18

you just need to connect to your

play13:20

database so the default mongodb server

play13:24

is running on localhost

play13:27

27017 Port just click on connect

play13:31

and you will be able to see all your

play13:33

databases you can see we have created

play13:36

mydb database and one collection here

play13:40

and our collection is there and we have

play13:43

just inserted one document inside our

play13:45

collection which was the name and it's

play13:49

there right

play13:51

so this is how you can view your mongodb

play13:56

data using this graphical user interface

play13:59

also from here you can also create the

play14:02

databases and collections

play14:04

so let me create one more collection

play14:06

which will be called let's say analytics

play14:11

and the

play14:13

collection name will be let's say sensor

play14:17

right and then from mongodb 5 you can

play14:22

also Define what type of collection you

play14:25

want so so from mongodb 5 onwards you

play14:28

can also create time series collection

play14:31

we don't want to create time series

play14:32

collection for now I'm going to just

play14:35

click on create database

play14:37

and you can see this database is created

play14:39

okay

play14:41

so this is how you can download and

play14:43

install mongodb server mongodb shell and

play14:47

mongodb compass on your Ubuntu operating

play14:50

system I hope you've enjoyed this video

play14:51

and I will see you in the next video

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
MongoDBUbuntuInstallationDatabaseServerShellCompassTutorialData ManagementGUI Client
¿Necesitas un resumen en inglés?