How to Install & Setup MEAN Stack on Ubuntu (MongoDB, Express.JS, Angular.JS, Node.JS)

Generally when you see stacks like LAMP and MEAN, a person would install the software in the order of the acronym from left to right. For example:

LAMP = Linux ⇢ Apache ⇢ MySQL ⇢ PHP
MEAN = MongoDB ⇢ Express ⇢ Angular ⇢ Node

You don't need to follow the order with everything, but it generally helps to do so. Let's get you started.

I don't even know the basics of installing...

First you will need an Ubuntu 20.04 or 21.04 installation ready to use. If you do not already have Ubuntu installed, download the version you would like, get it installed, then continue with this answer.

I don't know what would be the consequences if I did something wrong in setup or installing

The consequences would be that you learn how to fix your computer if something goes wrong. This isn't necessarily a bad thing.

How to build the MEAN stack

The following steps will give you the very basics of what you need on a modern Ubuntu installation. Please note that these steps work for 20.04 and 21.04. I did not do any testing on older releases or other flavours of Ubuntu.

  1. Open Terminal (if it's not already open)
  2. Install MongoDB:
    sudo apt update 
    sudo apt install mongodb 
    
    Now you can start MongoDB:
    sudo service mongod start
    
  3. Setup Git, nom, Express and Angular:
    sudo apt install git npm
    
    Then:
    npm install express --save
    npm install angular
    
  4. Install Node.js:
    sudo apt install nodejs
    
    Now you can test that Node is properly installed by calling the prompt:
    nodejs
    
  5. Start building your websites

There's a great deal more that can be done, but these basic steps will give you everything you need to start learning MEAN development.