How To Install a MEAN.JS Stack on an Ubuntu 16.04 Server?

MEAN.JS is a full-stack JavaScript solution that helps you build fast, robust, and maintainable production web applications using MongoDB, Express, AngularJS, and Node.js.

MEAN.JS will help you get started and avoid useless grunt work and common pitfalls while keeping your application organized. Our goal is to create and maintain a simple and readable open-source solution that you can use and trust in your projects.

In this tutorial, we’ll  install every component of MEANS.JS Stack onto an Ubuntu 16.04 Linux server, This will give us the applications and structure we need to create and install MEAN applications easily.

Install Mongo DB:

1. First, we need to add “MongoDB” key to the list of the trusted keys, the below command will add the right key to our list.

sudo apt-key adv –keyserver hkp:// –recv 7F0CEB10

2. After we had added the trusted keys we need to add a reference to the repository to the configuration settings, we can create a new separate file that will be filled by “APT” with the correct repository, we can do that by the below command.

echo ‘deb dist 10gen’ | sudo tee /etc/apt/sources.list.d/mongodb.list

3. Now our system is well configured with the new MongoDB repository, let’s update our packages then we will download and install MongoDB, by the below 2 commands.

sudo apt-get update 

sudo apt-get install mongodb-org git build-essential openssl libssl-dev pkg-config

Type “Y” and press Enter to continue, and then we are done from installing MongoDB.

Download and install Node.js from source:

1. Open your web browser and open the official website of Node.JS, and click on Downloads.

2. there will be the download links separated by each OS, as also the link for the source code in the upper-right corner of the downloads, Right click on the source code and select “Copy Link Location”.

3. Back to the “Terminal”, and navigate to your home directory by the below command.

cd ~

4. Use the command “wget” following the link you had copied and run it in “Terminal”, the command will look like the attached screenshot.

5. Once the download is complete, extract the downloaded archive, using the below command.

tar xzvf node-v*

6. After we had extracted Node.JS, let’s navigate to its directory, we can do that by the below command.

cd node-v*

7. On this step we need to configure and build the software, we can do this through the below command.



it will take a few minutes till it complete.

8. The software now is compiled, and we can install it, install it by the below command in “Terminal”.

sudo make install

9. Node now is successfully installed, but run the below 2 commands to clean your system of source code archive.

cd ~

rm -rf ~/node-v*

Installing the rest of the components

Now Node is successfully installed, MEAN JS uses a package manager named “Bower”, it’s responsible for managing front-end applications and also we have access to “NPM” package manager, we will use it to some software the tutorial required.

1. Install “Bower” through NPM command, run the below command in “Terminal”.

sudo npm install -g bower grunt-cli

2. We finally got all the prerequisite packages installed on the Linux server, We can proceed to install the actual MEAN.JS boilerplate used to create applications, But first, we need to clone the official GitHub repository inside a directory “/opt/mean” to get the latest update version of it, use the below command to get it.

sudo git clone /opt/mean

3. Now let’s navigate to the cloned directory and use “NPM” command to install all the required packages, we will perform that action by the below 2 commands.

cd /opt/mean

sudo npm install

4. Since we are located in a system directory, we need to run “bower” with command “sudo” and the “–allow-root” option to deploy&configure the front-end packages, do that like the command below.

sudo bower –allow-root –config.interactive=false install

5. Now MEAN.JS is finally installed, Open your web browser and write your IP address following by “:3000”.


I started this tech blog back in 2011 as a place to write down processes I took to fix my client systems and network. Now I write some tips and tricks to help others with the tech issues that one might encounter.

You may also like...