How to Install MERN Stack for JS based applications on Ubuntu 22.04
The MERN Stack is made from four components: MongoDB, Express, React, and Node. It provides a bundle of JavaScript technologies used for building dynamic JS websites.
MongoDB is an open-source and most widely used NoSQL database system used for developing robust web applications. Express.js is a Node.js web application framework used for developing hybrid web-based applications. React.js is an open-source JavaScript framework used to create a front-end interface for mobile applications. Node.js is a JavaScript environment that allows developers to run codes on the server.
In this guide, we will show you how to install the MERN stack on Ubuntu 22.04.
Useful Links:
VPS/VDS – https://www.mivocloud.com/
WARNING – ANGLED BRACKETS AREN’T ALLOWED IN DESCRIPTION SO BE ATTENTIVE TO THE VIDEO IN NANO EDITOR
Commands Used:
apt install wget gnupg2 curl -y
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add –
echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse” | tee /etc/apt/sources.list.d/mongodb-org-4.4.list
apt update -y
apt install mongodb-org -y
systemctl start mongod
systemctl status mongod
mongo –version
mongo –eval ‘db.runCommand({ connectionStatus: 1 })’
mongo
use admin
db.createUser(
{
user: “admin”,
pwd: “password”,
roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ]
}
)
curl -sL https://deb.nodesource.com/setup_18.x | bash –
apt-get install nodejs -y
node –version
npm –version
npm install -g create-react-app
create-react-app myapp
cd myapp
npm start 0.0.0.0
npm install -g express-generator
express myproject
cd myproject
npm install
npm start 0.0.0.0