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 updateIf Git is not installed on your system, install it by running:
$ sudo apt install gitInstalling MongoDB MongoDB is a NoSQL database that stores data in JSON-like documents.
- Import the MongoDB public key:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5- 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- Update the repository:
$ sudo apt-get update- Install MongoDB:
$ sudo apt-get install -y mongodb-org- Start the MongoDB service:
$ sudo systemctl start mongod $ sudo systemctl enable mongod- Verify the installation:
$ sudo lsof -iTCP -sTCP:LISTEN | grep mongoInstalling Node.js Node.js is a JavaScript runtime environment that enables server-side execution of JavaScript code.
- Install Node.js:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - $ sudo apt-get install -y nodejs- Install build dependencies:
$ sudo apt-get install build-essentialInstalling Dependencies
- Install project dependencies:
$ npm install- Install Bower and Gulp:
$ npm install -g bower $ npm install -g gulpInstalling MEAN.io Framework The MEAN.io framework simplifies the process of creating MEAN stack applications.
- Install MEAN-CLI:
$ npm install -g mean-cli- Create a new MEAN.io application:
$ mean init myapp- Navigate to the application directory:
$ cd myapp- Install server and client dependencies:
$ sudo npm install $ bower install- Run the application:
$ gulpThe 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.

