What is MEAN Technology

So, what is a MEAN stack? The idea is quite simple actually – there are 4 main parts:

These are some of the advantages of a MEAN stack:

  • Single language is used in the whole application
  • Support for the MVC pattern
  • JSON is used for transfering data
  • Node.js’s huge module library
  • Open source so you can tweak it to your preferences if you’re an experienced user

OK, enough with the chit-chat, now we’ll go and install all the necessary parts.

How to Install and Configure MongoDB on Ubuntu

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:// --recv 0C49F3730359A14518585931BC711F9BA15703C6

2. Create a list file for MongoDB.

Create the /etc/apt/sources.list.d/mongodb-org-3.4.list list file using the command appropriate for your version of Ubuntu:

Ubuntu 12.04
echo "deb [ arch=amd64 ] precise/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
Ubuntu 14.04
echo "deb [ arch=amd64 ] trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
Ubuntu 16.04
echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

3. Reload local package database.

Issue the following command to reload the local package database:

sudo apt-get update

4. Install the MongoDB packages.

Install the latest stable version of MongoDB.

Issue the following command:

sudo apt-get install -y mongodb-org

Run MongoDB Community Edition

Most Unix-like operating systems limit the system resources that a session may use. These limits may negatively impact MongoDB operation. See UNIX ulimit Settings for more information.

The MongoDB instance stores its data files in /var/lib/mongodb and its log files in /var/log/mongodbby default, and runs using the mongodb user account. You can specify alternate log and data file directories in /etc/mongod.conf. See systemLog.path and storage.dbPath for additional information.

If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongodb and /var/log/mongodb directories to give this user access to these directories.

1. Start MongoDB.

Issue the following command to start mongod:

sudo service mongod start

2. 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.log for a line reading

[initandlisten] waiting for connections on port 

where is the port configured in /etc/mongod.conf, 27017 by default.

3. Stop MongoDB.

As needed, you can stop the mongod process by issuing the following command:

sudo service mongod stop

4. Restart MongoDB.

Issue the following command to restart mongod:

sudo service mongod restart

5. Begin using MongoDB.

To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.

Before deploying MongoDB in a production environment, consider the Production Notes document.

Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.

Native Mongodb management tool or admin UI

Robomongo is a shell-centric cross-platform MongoDB management tool. Unlike most other MongoDB admin UI tools, Robomongo embeds the actual mongo shell in a tabbed interface with access to a shell command line as well as GUI interaction.

How to Install Robomongo

Click here to download robomongo tool. here is steps for connecting to mongo db

To add your DocumentDB: API for MongoDB account to the Robomongo MongoDB Connections, perform the following steps.

  1. Retrieve your DocumentDB: API for MongoDB account connection information using the instructions here.Screen shot of the connection string blade
  2. Run Robomongo.exe
  3. Click the connection button under File to manage your connections. Then, click Create in the MongoDB Connections window, which will open up the Connection Settings window.
  4. In the Connection Settings window, choose a name. Then, find the Host and Port from your connection information in Step 1 and enter them into Address and Port, respectively.Screen shot of the Robomongo Manage Connections
  5. On the Authentication tab, click Perform authentication. Then, enter your Database (default is Admin), User Name and Password. Both User Name and Password can be found in your connection information in Step 1.Screen shot of the Robomongo Authentication Tab
  6. On the SSL tab, check Use SSL protocol, then change the Authentication Method to Self-signed Certificate.Screen shot of the Robomongo SSL Tab
  7. Finally, click Test to verify that you are able to connect, then Save.

How to Install Express

Assuming you’ve already installed Node.js, create a directory to hold your application, and make that your working directory.

$ mkdir myapp
$ cd myapp
Use the npm init command to create a package.json file for your application. For more information on how package.json works, see Specifics of npm’s package.json handling.

$ npm init
This command prompts you for a number of things, such as the name and version of your application. For now, you can simply hit RETURN to accept the defaults for most of them, with the following exception:

entry point: (index.js)
Enter app.js, or whatever you want the name of the main file to be. If you want it to be index.js, hit RETURN to accept the suggested default file name.

Now install Express in the myapp directory and save it in the dependencies list. For example:

$ npm install express –save
To install Express temporarily and not add it to the dependencies list, omit the –save option:

$ npm install express
Node modules installed with the –save option are added to the dependencies list in the package.json file. Afterwards, running npm install in the app directory will automatically install modules in the dependencies list.

How to Install Nodejs

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. We can add this PPA to Ubuntu 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) Systems and install node.js with few easy commands.

Step 1: Add NodeJs PPA

First, you need to node.js PPA in our system provides by nodejs official website. We also need to install python-software-properties package if not installed already.

$ sudo apt-get install python-software-properties
$ curl -sL | sudo -E bash –
Step 2: Install Node.js and NPM

After adding required PPA file lets install Node package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

$ sudo apt-get install nodejs
Step 3: Check Node.js and NPM Version

After installing node.js verify and check the installed version. You can find more details about current version on node.js official website.

$ node -v

Also, check the version of installed npm.

$ npm -v

Step 4: Create Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js

$ vim http_server.js
and add following content

var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’});
res.end(‘Hello World\n’);
}).listen(3001, “”);
console.log(‘Server running at’);
Now start the web server using below command.

$ node –debug http_server.js

debugger listening on port 5858
Server running at
The web server has been started on port 3001. Now access URL in browser. Now you will need to configure a front end server for your app.

Leave a Reply