How To Install MEAN Stack with MEAN.JS on CentOS Server?

In this tutorial, we will discuss how to install MEAN stack on CentOS cloud server with the help of MEAN.JS.

1st Step - Installing Dependencies

Since we will be compiling applications from source, cloning a Git store, and installing Ruby gems, we will need to install a few conditions first. libpng-devel and fontconfig are required by one of the MEAN.JS modules.

$sudo yum install gcc-c++ make git fontconfig bzip2 libpng-devel ruby ruby-devel

Few of the Node.js modules that we will be installing will need Sass, a CSS augmentation language. Install it utilizing gem, Ruby's package manager.

$ sudo gem install sass


Since the dependencies  are installed, we can installed the main component of the stack: MongoDB.

2nd Step - Installing MongoDB

At time of writing this tutorial, MongoDB 3.6 is the most recent stable release accessible for download and installation. To empower the repository, make a document for it under /etc/yum.repos.d, the CentOS repository directory. For MongoDB 3.6, we will call that document

Create and open /etc/yum.repos.d/ using vi or using any other text editor.

$ sudo vi /etc/yum.repos.d/

To point the bundle administrator the official MongoDB archive and enable it, copy and paste the accompanying into the document. Setting enabled=1 empowers the repository and setting gpgcheck=1 turns on GNU Privacy Guard (GPG) signature minding all packages installed from the archive.



name=MongoDB Repository


Save and exit from the file, then install the MongoDB-org package in order to install MongoDB and other related tools.

When prompted to import the GPG key, enter y for yes:

$ sudo yum install mongodb-org

Once the installation complete, start the MongoDB daemon.

$ sudo systemctl start mongod


mongod, the MongoDB daemon, must now be functioning, and you can check that using the following command:

$ sudo systemctl status mongod


3rd Step - Installing Node.js

Use the below mentioned commands
$ curl -sL | sudo -E bash -

Next, install Node.js & npm, a package manager for Node.js.

$ sudo yum install -y nodejs

Confirm that Node.js and npm are installed.

$ npm version

The result should be:


{ npm: '2.15.9',
 ares: '1.10.1-DEV',
 http_parser: '2.7.0',
 icu: '56.1',
 modules: '46',
 node: '4.5.0',
 openssl: '1.0.2h',
 uv: '1.9.1',
 v8: '',
 zlib: '1.2.8' }

4th Step - Installing Bower & Gulp


First install Bower:

$ sudo npm install -g bower

Now install Gulp:

$ sudo npm install -g gulp


5th Step - Installing the MEAN Boilerplate

First of all, we will clone the official MEAN.JS GitHub repository.

$ git clone meanjs

That clones the MEAN.JS standard into a catalog called meanjs in your home index. To introduce the majority of the bundles the venture references, you should be inside that catalog, so move into it.

$ cd ~/meanjs

AFter that install the essential packages as the non-root user.

$ npm install


6th Step - Running Your Sample MEAN Application

Here, we will use npm.

$ npm start

Note: The underlying keep running of both of these charges may fall flat with yield like this:

Error output

[15:48:58] 'lint' errored after 802 ms
[15:48:58] Error in plugin 'run-sequence'
   An error occurred in task 'sass'.

On the off chance that you get this error, the fix is basic. It includes erasing the node_modules registry, clearing the store, at that point reinstalling the bundles.

$ rm -rf node_modules
$ npm cache clean
$ npm install

After that restart the sample app with npm command start or gulp as before.