How to Install MongoDB on Ubuntu 16.04
HTML Tutorial: How to Install MongoDB on Ubuntu 16.04
Keywords: MongoDB, Ubuntu 16.04, installation, tutorial
MongoDB is a popular NoSQL database management system used by many web applications. In this tutorial, you will learn how to install MongoDB on Ubuntu 16.04.
Step 1: Add MongoDB Repository
To install the latest version of MongoDB, you need to add its repository. Open a terminal window and enter the following command to import the MongoDB GPG key:
```
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
```
Next, add the MongoDB repository by running the following command:
```
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
```
Step 2: Install MongoDB
Once the repository is added, update the package list and install MongoDB using the following command:
```
sudo apt-get update
sudo apt-get install -y mongodb-org
```
Step 3: Start MongoDB Service
After the installation is complete, start the MongoDB service using the following command:
```
sudo systemctl start mongod
```
To ensure that the service starts automatically at boot, enable it using the following command:
```
sudo systemctl enable mongod
```
Step 4: Verify MongoDB Installation
To verify the installation, run the following command:
```
mongo --eval 'db.runCommand({ connectionStatus: 1 })'
```
If MongoDB is installed and running correctly, you will see output similar to the following:
```
{
"authInfo" : {
"authenticatedUsers" : [ ],
"authenticatedUserRoles" : [ ]
},
"ok" : 1
}
```
Congratulations! You have successfully installed MongoDB on Ubuntu 16.04.
Keywords: MongoDB, Ubuntu 16.04, installation, tutorial
Комментарии
Отправить комментарий