Monday, February 7, 2022

How To install MERN Stack On Ubuntu 20.04

 in This Tutorial you will learn " How to Install MERN Stack for JS based applications on Ubuntu 20.04"


MERN stack is a combination of MongoDB, Express, React, Node. All of them are based on Javascript and the stack is used to build modern web applications. It is comprising the front-end (React), back-end (Node and Express), and database components (MongoDB).

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.
_________________________________________________________________________________________
Server - Os:  Ubuntu 20.04.3 LTS 64Bit        | IP -192.168.1.80            |Hostname -  ubuntu.example.com
_________________________________________________________________________________________
lsb_release -d ; hostname -I ; hostname ; apt-get install gnupg2 wget curl unzip git -y
wget -qO- 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-get update -y ; apt-get install mongodb-org -y
systemctl start mongod ; systemctl enable mongod ; systemctl status mongod
mongo
use admin
db.createUser({user: "admin" , pwd: passwordPrompt() , roles: [{ role: "userAdminAnyDatabase" , db: "admin"}]})
quit()

curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install nodejs -y
npm install -g create-react-app
create-react-app myapp
cd myapp ; npm start 0.0.0.0
http://127.0.0.1:3000

npm install -g express-generator
express myproject
cd myproject
npm install
npm start 0.0.0.0
http://127.0.0.1:3000
________________________________________________________________________________________



No comments:

Post a Comment