How to Install MongoDB 3.4 on Ubuntu 16.04/14.04
MongoDB is a NoSQL database that offers a high performance, high availability, and automatic scaling enterprise database. NoSQL refers to a database with a data model other than the tabular format used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. MongoDB features include: full index support, replication, high availability, and auto-sharding. MongoDB provides large media storage with GridFS. Click here to more details about MongoDB 3.4.
See Also:
This article will help you to install MongoDB 3.4 on Ubuntu 16.04/14.04 systems.
Import the Public Key
First we will import the MongoDB GPG public key in our system using following command.
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Adding Apt Repository
Create a MongoDB list file in /etc/apt/sources.list.d/ with this command:
For Ubuntu 16.04:
$ echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-3.4.list
For Ubuntu 14.04 & 12.04:
$ echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-3.4.list
Install MongoDB
Now that the MongoDB repository has been added, use following commands to install MongoDB in your systems.
$ sudo apt-get update $ sudo apt-get install mongodb-org
If you want to install any specific version of MongoDB, define the version number like below
$ apt-get install mongodb-org=3.4.1 mongodb-org-server=3.4.1 mongodb-org-shell=3.4.1 mongodb-org-mongos=3.4.1 mongodb-org-tools=3.4.10
Start MongoDB Service
Start mongodb and add it as service to be started at boot time:
For Ubuntu 16.04:
$ sudo systemctl start mongod $ sudo systemctl enable mongod
For Ubuntu 14.04 & 12.04:
$ sudo service mongod start $ sudo chkconfig mongod on
Verify MongoDB Installation
Finally use the below command to check installed MongoDB version on your system.
$ mongod --version
db version v3.4.1 git version: 5e103c4f5583e2566a45d740225dc250baacfbd7 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 allocator: tcmalloc modules: none build environment: distmod: ubuntu1604 distarch: x86_64 target_arch: x86_64
Also you can check that mongodb has been started on port 27017 with the netstat command.
$ netstat -ntulp | grep mongod
For more information on how to customize these and other values in your configuration file, refer to the official MongoDB configuration tutorial.
Enjoy it!
when did you publish this post?