In this article we will highlight what is a mean stack and how to install MEAN stack in Ubuntu.
What is the MEAN stack
MEAN stack is a bundle of JavaScript technologies that is more convenient for building dynamic JS websites. The best thing about MEAN stack is that all these technologies support the same language for both front-end and back-end. This increases efficiency and reduces the confusion that a lot of developers face while using different technologies that have different languages.
M in MEAN stands for MongoDB. It is a simple NoSql and object-oriented database technology that is efficient and scalable for large data storage. MongoDB stores data as objects in JSON format, in separate documents instead of storing in rows and columns like in a typical relational database. This increases productivity in the manipulation and retrieval of data in abundance.
E in MEAN stack stands for express JS. Express js or express is a node js framework that promotes the rapid development of node-based web and mobile applications. Express supports the MVC framework which helps in building more scalable, structured and dynamic websites. Express focuses more on the back-end or the developer side.
A in mean stack stands for Angular. Angular is an MVC framework for the client end or front end. Angular allows us to create a strong interactive web or mobile application. It also has great support for creating cross-platform and progressive web applications.
N in mean stack stands for Node JS. Node JS allows out to write JavaScript on the server or outside of the browser. Node uses an event-driven, non-blocking I/O model that makes it lightweight and effectual, seamless for applications that run across distributed devices.
step 1: update
the first thing before starting is to update your OS
sudo apt update

step 2: Install MongoDB
you need to install MongoDB from its repository. For that, you need to get the key first. type the following command.
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -

the terminal should give you an ok.
Now install mongoDB by simplifying running
sudo apt install -y mongodb

Your MongoDB should be installed and ready to use. Run the following command to start your database.
sudo systemctl start mongod
If you get the following result “failed to start mongod.service…..”
then reload mongoDB and run the above command again. For reloading run:
sudo systemctl daemon-reload
You can verify that your mongoDB is up and running by checking its status
sudo systemctl status mongod

You can stop and restart MongoDB by the following commands
sudo systemctl stop mongod
sudo systemctl restart mongod

Step 3: installing Node JS
First, you need to make sure you have curl installed
sudo apt install curl

then run the following command to download node
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -

now install node js by simply running
sudo apt-get install -y nodejs

step 4: install express js
Once node js is installed you can use npm to install express easily.
First install npm,
sudo apt install npm

You can create a directory and install express in it to keep all the dependencies in a file.
mkdir directoryName
cd directoryName

Execute the following command
npm init
after running the command it will ask you details of your project or app to be created. Fill them in and continue

Run the command to install
sudo npm install express –save

Step 5: Install Angular
You need to install angular cli first in your ubuntu. Angular cli (command-line interface) automates your development workflow by generating codes of components, services, etc.
npm install -g @angular/cli

When the installation is completed, you need to create a booking for your angular application.
ng new projectName


Press ‘y’ for continuing. Wait till the procedure is completed.
Now go to your project directory
cd projectName
then type to start your server and to get a localhost IP
ng serve

once you get your localhost address, copy it and run it in your browser.
You get a home page of your Angular booking. This means Angular cli is successfully installed and running.
Now you can install Angular packages through either npm or yarn. For example, you can use npm to install the following package.
npm install –save @angular/material @angular/cdk @angular/animations

Now you need to add the packages installed in your project.
ng [email protected]/material
you can choose which theme to select from after adding the package.
For more details on how to install Mean stack on different OS click here