Install MEAN Stack Dev Environment On Ubuntu/Debian

Exported on 28-Sep-2021 13:36:55

Install MEAN Stack Development Environment On Ubuntu and Debian

This Blueprint installs MEAN stack development system on Debian based systems.

The MEAN stack is JavaScript-based framework for developing web applications. MEAN stack is one of the most popular Technology Stack. It is used to develop a Full Stack Web Application and consists of MongoDB, Express.js, Angular.js, and Node.js.

MongoDB MongoDB is a cross-platform source-available document-oriented database program, it is a NoSQL database program. MongoDB is the leading general purpose database platform, modern, designed to unleash the power of data and software for applications and the developers.

Express.js Express, is a Node.js back-end web application framework, released under the MIT licence as a free and open-source software. It is designed for building web applications and APIs. It has been called the de facto standard server. Express philosophy is to provide small, robust tooling for HTTP servers, making it a great solution for single page applications, websites and hybrids.

Angular.js AngularJS is a toolset for building frontends, the framework is most suited to your application development. It is fully extensible and works well with other libraries. AngularJS is a JavaScript framework. It can be added to an HTML page with a script tag. AngularJS is maintained mainly by Google, and extends HTML attributes with Directives, and binds data with Expressions.

Node.js Node.js is a free, open-sourced, cross-platform JavaScript run-time environment that lets developers write command line tools and server-side scripts. With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy with NodeJS. Node was initially conceived for the purpose of making asynchronous programming easy and convenient.

Pre-Blueprint Attune setup
  1. On the Inputs tab, create a Linux node for the host you wish to install the stack on.
  2. On the Inputs tab, create Linux credentials to connect to the host you wish to install the stack on.
Steps Involved
  • Update apt packages.
  • Install and configure MongoDB
  • Install and configure NodeJS with NPM
  • Install and configure MEAN Stack components from MEAN.io

Parameters

Name Type Script Reference Default Value Comment
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser
Linux Node Linux / Unix Server linuxNode
Linux User Linux OS Credential linuxUser

1 - Update apt repositories

Update apt packages

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install APT update
sudo apt update

2 - Installs Node Package Manager

Installs NPM (Node Package Manager) for dependency management

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install npm
sudo apt -y install npm

3 - Install MongoDB

This installs MongoDB database server

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Move MongoDB repo file
sudo mv uploads/mongodb-org-4.4.repo /etc/yum.repos.d/mongodb-org-4.4.repo

# Install MongoDB
sudo apt install -y mongodb-org

4 - Install NodeJS v16

This installs NodeJS server into the target machine

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Download setup script
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

# Start installation 
sudo apt-get install -y nodejs

5 - Download MEAN.io Stack

Downloads MEAN Stack Packager From Git

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
git clone https://github.com/linnovate/mean

6 - Install Node Dependencies

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Change current working directory
cd mean

# Install Node Dependencies
npm i --force

# Create environment file
cp .env.example .env

7 - Install and configure screen

Installs and configures screen package to run the development server in background.

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Install Screen 
sudo apt install -y screen && 

# Configure mean stack
sudo echo "zombie xy" >> ~/.screenrc

8 - Start Development Server

This starts the development server on port 4040 of the target machine.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
# Start development server
cd ~/mean && screen -d -m npm start