How to easily install MEAN Stack in Ubuntu?

How to easily install MEAN Stack in Ubuntu?

Table of Contents

MEAN Stack is a great way to build JavaScript web application easily.

But, to build the application, we need to first install the multiple components of MEAN Stack. And, the steps differ depending on the server type too.

That’s why, we often get requests to install MEAN Stack in Ubuntu servers as part of Infrastructure Management Services.

Today, we’ll see how our Dedicated Engineers install MEAN Stack in Ubuntu servers and fix common errors with it.



What is MEAN stack?

Firstly, let’s get an idea about MEAN stack.

MEAN is a framework that helps in building dynamic websites. It is a set of open source components. MEAN is the acronym of components like MongoDB, Express, Angular and Node.

In MEAN Stack, everything is based on JavaScript language. Therefore, it can easily handle all aspects of an app including code running in the browser to the database back-end.

In short, MEAN stack makes an efficient and modern approach to web development in Linux servers.


How we setup MEAN Stack Ubuntu server ?

Till now, we saw the details about MEAN stack and its benefits. We’ll now see how our Dedicated Engineers setup an Ubuntu server with MEAN Stack.

We begin the process by ensuring that the Ubuntu server has all the package updates. For this, we run the command apt-get update as the root user. This will fetch all the packages and update the linux system.


1. Install MongoDB

To begin with, we install MongoDB on the server. MongoDB is available in the Ubuntu repository. But, Ubuntu package management tools like dpkg and apt need proper keys to install every package.

To add the MongoDB’s key, we use the command:

apt-key adv --keyserver hkp:// --recv 4x30AXXXXX73BB4B58712A2291FA4AD5

Further, our Support Engineers create a file at /etc/apt/sources.list.d/mongodb.list and add the MongoDB repository url in it. Now, we install and start MongoDB using the command:

apt-get install -y mongodb-org
systemctl start mongod


2. Setup Express and Angular

Next, it’s the time to setup the components like Express and AngularExpress is the back-end web application framework that runs on top of Node.js. Similarly, Angular is the front-end framework that makes the app a dynamic one.

But, to setup Express and Angular, we need to first install NPM, a package manager for the JavaScript programming language. To get npm on the server, we issue the commands:

apt-get install npm
apt-get update

We also setup git on the server. Now that npm and git packages are available on the server, it’s pretty easy to setup Express and Angular. To install them, our Dedicated Engineers use :

npm install express --save
npm install angular


3. Install Node

Now, we need to finish the MEAN Stack installation by setting up the last component Node. For this, we use the command:

apt-get install nodejs

This installs Nodejs on the server. Now, to run node, we simple enter the command nodejs. It will take us to the node prompt.

Again, there can be some changes in MEAN Stack installation as per customer requirement too. For example, some customer may setup Bower as a package manager for the front-end apps, and use gulp to automate tasks. Also, in certain cases, to get the recent version of actual MEAN.JS boilerplate, we clone the official GitHub repository into a directory at the linux server. This requires git package on the server.

And, now its time to start the MEAN stack project and the mean.js page shows up in the browser.


Common errors with MEAN Stack install and their fixes

Although the steps for installing MEAN Stack looks straight forward, we often see customers having tough time while setting it up. Now, let’s see the top problems and how our Support Engineers fix them.


1. Problem with older versions

From our experience in managing servers, we often see customers experiencing problems when installing older component versions. For example, while installing nodejs-legacy, it showed the error as:

Reading package lists... Done Building dependency tree Reading state information... Done Package nodejs-legacy is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: nodejs:i386 nodejs

In this case, nodejs-legacy package just creates a link so that the command node runs the command nodejs.
But, this do not work with older version of nodejs.  Therefore, to fix the problem, our Dedicated Engineers had to proceed with the installation of latest nodejs package.


2. NPM install failure

Recently, one of our customers had problems with installing NPM when doing MEAN Stack setup in Ubuntu. It reported the error as:

node-pre-gyp WARN Pre-built binaries not found for node@10.15.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make

As shown in the error, there was problems finding the “make” binary on the server. Therefore, our Dedicated Engineers fixed the problem by using the following commands.

sudo apt-get update
sudo apt-get install build-essential


[Need help in installing MEAN Stack on Ubuntu server? We can help right away.]



In short, MEAN Stack is one of the popular ways to build JavaScript apps. Today, we saw how our Support Engineers install MEAN Stack in Ubuntu servers and fix common set up errors.

Leave a Comment

Your email address will not be published. Required fields are marked *

Social Share


Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale


Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month


Use coupon: at the checkout.