Install The MEAN Stack On Ubuntu 18.04 Bionic Beaver Linux


Install the MEAN stack on Ubuntu 18.04


Ubuntu 18.04


A working install of Ubuntu 18.04 with root privileges




  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user


The MEAN stack is quickly becoming a favorite among web developers. MEAN stands for MongoDB, ExpressJS, AngularJS, and NodeJS. Clearly, this is a JavaScript heavy tech stack, so it’s not for people who don’t like JS. However, it does provide an excellent framework for building lightweight and fully capable web applications.

Install MongoDB

MongoDB is a NoSQL database that’s gereally thought of as being more nimble than SQL options. Because of this, it pairs well with NodeJS based applications.

MongoDB is available in Ubuntu’s repositories, but it’s already outdated. So, it’s better to install it directly from MongoDB’s repositories. Begin by adding MongoDB’s key.

$ sudo apt-key adv --keyserver hkp:// --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
Add MongoDB Source On Ubuntu 18.04

Add MongoDB Source On Ubuntu 18.04

Next, create a file at /etc/apt/sources.list.d/mongodb.list. Open it with your favorite text editor, and add the line below.

deb xenial/mongodb-org/3.6 multiverse

Notice that it says xenial. As of this article, there is no repository for Bionic. You might want to check this before installing.

You can now update Apt and install MongoDB.

$ sudo apt install mongodb-org

Install NodeJS, NPM, and Git

NodeJS is obviously a critical component of this setup. The LTS release of Node is available in the Ubuntu repositories. If you want to go with that release, just install it normally.

$ sudo apt install nodejs npm git

If you want the absolute latest release of NodeJS, you can add the Node repository to Ubuntu. Note: as of now, Bionic is not supported. This will probably change soon.

curl -sL | sudo -E bash -

Then, install your packages.

$ sudo apt install nodejs npm git

Install The Rest

There is a way to set this all up manually, but it takes more time that you’d ideally want when setting up a new project. Thankfully, there is a more convenient way to install and set everything up with Git and NPM. So, begin by cloning the repository where you want to build your project.

$ git clone

Next, change into the resulting directory.

$ cd mean
Install MEAN With NPM On Ubuntu 18.04

Install MEAN With NPM On Ubuntu 18.04

Use NPM to automatically download and install all of the remaining dependencies and set them up.

$ npm install

Finally, you can use NPM to start up a development server for your project.

$ npm start
MEAN Stack Running On Ubuntu 18.04

MEAN Stack Running On Ubuntu 18.04

You are now running the MEAN stack on your Ubuntu machine!

Closing Thoughts

Obviously, there is a lot more that you need to do, if you want to deploy this into production. This setup is mostly for development purposes. You’ll also need to hook up your database for production use as well. Right now, though, you have all the makings needed to get started with the MEAN stack.