MEAN is a free and open-source JavaScript software stack for building dynamic websites and web applications. The MEAN stack is MongoDB, Express.js, AngularJS (or Angular), and Node.js. Because all components of the MEAN stack support programs are written in JavaScript, MEAN applications can be written in one language for both server-side and client-side execution environments.
The components of the MEAN stack are as follows:
MongoDB: a NoSQL database. It makes easier to pass data between client and server.
Express.js: a web application framework that runs on Node.js
Angular.js or Angular: JavaScript MVC frameworks that run in browser JavaScript engines
Node.js: an execution environment for event-driven server-side and networking applications
Install Dependencies
First of all, we have to install some dependencies in order to proceed,
yum install gcc-c++ make git fontconfig bzip2 libpng-devel ruby ruby-devel
gem install sass
Install MongoDB
In this section, we are going to install MongoDB as our Database, in order to install the latest stable version of MongoDB you should add the official repository first. create a new file with your text editor:
nano /etc/yum.repos.d/mongodb.repo
Paste the following lines in it then save and exit:
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Now you can easily install MongoDB with the following command:
yum install mongodb-org
After the installation process is finished you can start and enable the MongoDB service with the commands below:
systemctl start mongod
systemctl enable mongod
Install NodeJS 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:
curl -sL https://rpm.nodesource.com/setup_8.x | bash -
Now you can execute the command below to install Node.JS and NPM:
yum install nodejs
Check the installed versions:
node -v
v8.6.0
npm -v
5.3.0
Install Bower and Gulp
Bower is package management tool for client-side programming and it depends on NodeJS and NPM.
You can install Bower with this NPM command:
npm install -g bower
Gulp is a JavaScript task runner that can automate many tasks, you can install it with NPM command as well:
npm install -g gulp
For verifying that Bower and Gulp are installed successfully you can execute the following command:
npm list -g --depth=0
You should see something like below:
/usr/lib
├── bower@1.8.2
├── gulp@3.9.1
└── npm@5.3.0
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:
git clone https://github.com/meanjs/mean.git
Switch to the MEAN main directory:
cd mean
Install MEAN with the following command:
npm install
After the installation process is finished without errors you can execute the command below to install the front-end stuff:
bower install --allow-root
Start and Test
You can easily start your MEAN stack project with the following command:
npm start
To check, please enter the following address and MEAN stack default page will be loaded
http://IP_Address_Or_Dmain:3000