How to install MEAN Stack (MongoDB, Express.JS, Angular.JS, Node.JS) on Ubuntu 16.04

Introduction

MEAN.js is full javascript stack that contains MongoDB, Express JS, Angular JS, and Node JS. This javascript framework accelerates the web application development using Javascript as backend.

Using the MEAN stack you can rapidly build easily maintainable web applications based on Javascript.avascript.


MongoDB- is schemaless NoSQL database system, MongoDB saves data in binary JSON format which makes it easier to pass data between client and server.

Express JS -  is a lightweight framework used to build web applications in Node. It provides a number of features for building single and multi-page web applications.

Angular JS - is a Javascript framework developed by Google. it provides some awesome features like two-way data binding. It is a complete solution for rapid and awesome front-end development.

Node JS -  is server-side Javascript execution environment. It's a platform built on Google Chromes V8 Javascript runtime. It helps in building highly scalable and concurrent application rapidly.

MEAN Installation-
To Install MEAN stack, first, we need to install dependencies - To install prerequisites run below command.

Step 1- Dependencies Installation:
$ sudo apt-get install build-essential git fontconfig libpng-dev ruby ruby-dev
After finish above prerequisites installation, use below command to install sass.
$ sudo apt-get install sass
Once all the above dependencies get installed. let's proceed for MEAN stack installation.
Step 2- Install Mongo DB:
In order to install Mongo DB as the database server. First, add MongoDB official repository:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Run the command below to add repository data to the local system correct path
$ sudo echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
Once, repository added. Update package databased 
$ sudo apt-get update
After package database update, we can proceed MonogDB installation.
To install MongoDB run following command.
$ sudo apt-get install mongodb-org
To install a specific release of MongoDB use following command. For example, I would like to install MongoDB version 3.6.3
$ sudo apt-get install -y mongodb-org=3.6.3 mongodb-org-server=3.6.3 mongodb-org-shell=3.6.3 mongodb-org-mongos=3.6.3 mongodb-org-tools=3.6.3
After MongoDB installation, Start MongoDB service using below command.
$ sudo systemctl start mongod.service
Let's check MongoDB service status-
$ sudo systemctl status mongod.service
Enable MongoDB Service to start at system boot.
$ sudo systemctl enable mongod.service
Step 3- Install Node JS and NPM -
In order to install Node.JS and NPM we have to add the “NodeSource” repository, the following bash script will do this easily:
$ sudo curl -sL https://deb.nodesource.com/setup_8.x | -E bash -
Now, Install Node.JS and NPM 
$ sudo apt-get install nodejs
Check installed NodeJS version
$ sudo node -v
For NPM version
$ sudo npm -v 
Step 4- Install Yarn and Gulp -
yarn is package management tool for client-side programming and it depends on NodeJS and NPM
You can install Yarn with NPM command.
$ sudo npm install -g yarn
Gulp is a JavaScript task runner that can automate many tasks, you can install it with NPM command as well:
$ sudo npm install -g glup
For verifying that Bower and Gulp are installed successfully you can execute the following command:
$ sudo npm list -g --depth=0
You should see something like below:
/usr/lib
├── yarn@1.3.2
├── gulp@3.9.1
└── npm@5.3.0
Step 5 - Download and Install MEAN from Git.
Now we can download the latest version of MEAN which is “0.6.0” at the time of writing.
Execute the following command:

$ cd /opt
$ sudo git clone https://github.com/meanjs/mean.git
Switch to MEAN the main directory:
$ sudo cd mean
Now, Install mean with the following command.
$ sudo npm install
After the installation process is finished without errors you can execute the command below to install the front-end stuff:
$ sudo yarn install --allow-root
Step 6 - Start and test MEAN
Now, you can easily start MEAN stack Project with the following command.
$ sudo npm start

To run npm start command in the background run the following command. This command will help us to keep running npm server in the background.
$ sudo nohup npm start &
It should run without any errors and you can look up your MEAN stack default page through the following address:
http://IP_addresss:3000
You should see a page like below:

Congrats! you have successfully configured MEAN stack and run the sample application!



19 comments:

  1. IT's very informative blog and useful article thank you for sharing with us , keep posting such quality content.
    MEAN Stack Training
    MEAN Stack Online Training

    ReplyDelete
  2. Top Tattoo Academy in Delhi. There are so many types of tattoo like Body Tattoo, Back Tattoo, Wrist Tattoo, Full Body Tattoo, Tattoo for Men, Tattoo for Women in Delhi Tattoo gives a different look to your body. Lots of design of tattoo in the market.

    ReplyDelete
  3. We are providing the Top rank Tattoo Studio. There are so many types of tattoo like Body Tattoo, Back Tattoo, Wrist Tattoo, Full Body Tattoo, Tattoo for Men, Tattoo for Women in Delhi Tattoo gives a different look to your body. Lots of design of tattoo in the market. For more details call: 8745801112 or visit

    ReplyDelete
  4. We are providing one of the best Printer on Hire in Delhi NCR. For more Details call: 9999924096 or visit

    ReplyDelete
  5. Nice Post! These days, full stack programmers are in widespread demand. Startups and small companies seeking to digitize their products are looking for total stack programmers to start manufacturing their products. Hire mean stack developers, hire python developers, hire mern stack developers, and more.

    ReplyDelete
  6. Great Content. It will useful for knowledge seekers. Keep sharing your knowledge through this kind of article.
    Mean Stack Training in Chennai
    React JS Training in Chennai

    ReplyDelete

  7. Thank you for sharing such valuable and helpful information and knowledge. You have some quality information here that any reader would enjoy Keep it up. I would love to see your next update.Share Tips|Stock Tips

    ReplyDelete
  8. thanks for sharing this . get the best food delivery app from-https://lilacinfotech.com/products/lilac-foodmine

    ReplyDelete
  9. Nicely Described! To support the demand for node.js app development, I would also like to share that, 43% of Node JS devs use it for enterprise applications and 85% use it primarily for web app development in 2022. Constantly, node.js development companies are rising rapidly with the increasing demand of node.js development services.

    ReplyDelete
  10. Thanks for sharing this informative article on Linux, Cloud & Windows tutorials for beginners. If you want to hire mean stack developers for your project. Please visit us.

    ReplyDelete
  11. The blog was super informative and easy to understand. I really appreciate the way you have informed us about the Mean Stack Training in Noida.

    ReplyDelete