VPSWala Blog

How to Install & Setup MEAN Stack on Ubuntu?

March 13, 2024, Written by 0 comment

The following guide will walk you through the steps to install and set up the MEAN stack on an Ubuntu virtual server.

Introduction

The MEAN stack is a combination of MongoDB, Express.js, Angular.js, and Node.js. It provides a full-stack JavaScript solution for building modern web applications.

Also read: How To Install Docker and Kubernetes on Your VPS?

Prerequisites Before proceeding with the installation, ensure that your Ubuntu machine is set up and ready. Update the Ubuntu repository by running the following command:

$ sudo apt-get update

If Git is not installed on your system, install it by running:

$ sudo apt install git

Installing MongoDB MongoDB is a NoSQL database that stores data in JSON-like documents.

  1. Import the MongoDB public key:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
  1. Create the MongoDB source list file:
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
  1. Update the repository:
$ sudo apt-get update
  1. Install MongoDB:
$ sudo apt-get install -y mongodb-org
  1. Start the MongoDB service:
$ sudo systemctl start mongod $ sudo systemctl enable mongod
  1. Verify the installation:
$ sudo lsof -iTCP -sTCP:LISTEN | grep mongo

Installing Node.js Node.js is a JavaScript runtime environment that enables server-side execution of JavaScript code.

  1. Install Node.js:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - $ sudo apt-get install -y nodejs
  1. Install build dependencies:
$ sudo apt-get install build-essential

Installing Dependencies

  1. Install project dependencies:
$ npm install
  1. Install Bower and Gulp:
$ npm install -g bower $ npm install -g gulp

Installing MEAN.io Framework The MEAN.io framework simplifies the process of creating MEAN stack applications.

  1. Install MEAN-CLI:
$ npm install -g mean-cli
  1. Create a new MEAN.io application:
$ mean init myapp
  1. Navigate to the application directory:
$ cd myapp
  1. Install server and client dependencies:
$ sudo npm install $ bower install
  1. Run the application:
$ gulp

The application should now be accessible at http://localhost:3000.

This guide covers the essential steps to install and set up the MEAN stack on an Ubuntu virtual server. For more advanced configuration or troubleshooting, refer to the official documentation of each component.

vpswala Admin

Savita Sathe is an experienced writer and editor with over 10+ years of professional experience creating engaging content across industries. Whether it's blogs, whitepapers, website copy, emails, social media posts, or more. She develops effective hosting and tech content that helps brands connect with their audiences and achieve business goals.

Leave a reply

Your email address will not be published. Required fields are marked *