Introducing MEVN Chapter 1
- To stop the mongod process:
$ sudo service mongod stop
- To restart the mongod process:
$ sudo service mongod restart
Installing MongoDB using tarball
- Download the binary file from https://www.mongodb. com/ download-center?_
ga=2.230171226.752000573.1511359743-2029118384. 1508567417. Use this
command:
$ curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-
3.4.10.tgz
- Extract the downloaded files:
$ tar -zxvf mongodb-linux-x86_64-3.4.10.tgz
- Copy and extract to the target directory:
$ mkdir -p mongodb
$ cp -R -n mongodb-linux-x86_64-3.4.10/ mongodb
- Set the location of the binary in the PATH variable:
$ export PATH=<mongodb-install-directory>/bin:$PATH
- Create a directory to be used by Mongo to store all database-related data:
$ mkdir -p /data/db
- To start the mongod process:
$ mongod
Installing MongoDB on Windows
Installing MongoDB from the installer is as easy as installing any other software on
Windows. Just like we did for Node.js, we can download the MongoDB installer for
Windows from the official website (https://www.mongodb.com/download-center#atlas).
This will download an executable file.