To connect to MongoDB, start the mongo shell: $ mongoįor more details check the official MongoDB installation guide. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name Out of the box, MongoDB has no authentication and is listening only on localhost on the default MongoDB port 27017: $ sudo netstat -tnlp net: port: 27017 bindIp: 0.0.0.0 Start MongoDB sudo systemctl start mongod Check MongoDB status sudo systemctl status mongod Enable MongoDB so it starts on boot sudo systemctl enable mongod. Start the mongod service and add it to auto-start: Install MongoDB sudo apt-get install -y mongodb-org Update /etc/nf for remote access sudo vim /etc/nf Edit bindIP: with setting below. Install the latest version of MongoDB: $ sudo yum install -y mongodb-org Import the public key: $ sudo rpm -import Start the mongod service and add it to auto-start: $ sudo systemctl start mongodĪdd the official MongoDB repository: $ echo 'īaseurl=$releasever/mongodb-org/4.0/x86_64/ $ sudo apt-get install -y mongodb-org=4.0.3 To install a specific version of MongoDB, run: Install the latest version of MongoDB: $ sudo apt-get update Import the public key: $ sudo apt-key adv -keyserver hkp://:80 \ $ echo "deb trusty/mongodb-org/4.0 multiverse" \ $ echo "deb xenial/mongodb-org/4.0 multiverse" \ | sudo tee /etc/apt//mongodb-org-4.0.list $ echo "deb bionic/mongodb-org/4.0 multiverse" \ Install MongoDB on UbuntuĪdd the official MongoDB repository: # Ubuntu-18.04: Specific Release: To install MongoDB from a specific release, check the official MongoDB repository and appropriately change the names and repo URLs.
It is one of the most powerful NoSQL databases and is commonly used in modern web applications.įrom the following article you will find out how to install the latest (or specific) version of MongoDB on Ubuntu and CentOS. What is MongoDB? MongoDB is an open-source document-oriented database.