How to install MongoDB 3.4 on Linux Mint 18.1 Serena
How to install MongoDB 3.4 on Linux Mint 18.1 Serena?
Ubuntu comes with its own official MongoDB package, but with older version:
$ mongo --version
MongoDB shell version: 2.6.10
To install a more up-to-date version, use official MongoDB Community Edition package.
- Import the public key used by the package management system.
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
- Create a list file for MongoDB.
/etc/apt/sources.list.d/mongodb-org-3.4.listlist file using the command appropriate for your version of Ubuntu:
$ echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
- Reload local package database.
Issue the following command to reload the local package database:
$ sudo apt-get update
- Install the MongoDB packages.
To install the latest stable version of MongoDB, issue the following command:
$ sudo apt-get install -y mongodb-org
- Start MongoDB.
Issue the following command to start
$ sudo service mongod start
- Verify that MongoDB has started successfully.
Verify that the mongod process has started successfully by checking the contents of the log file at
/var/log/mongodb/mongod.logfor a line reading
[thread1] waiting for connections on port <port>
where <port> is the port configured in /etc/mongod.conf,