How to install mean.js from scratch on Ubuntu 12.04

This article details how to install from scratch on Ubuntu 12.04, complete with bash script you can just download and run on your machine.

I’ll update this periodically as this process changes. This article was last updated April 11, 2014.

First we need to install node.js, npm and bower.

# Update repositories
sudo apt-get update
# Install git
sudo apt-get -y install git
# Install build tools
sudo apt-get -y install build-essential
# Clone node.js source code
git clone
# Configure, make and install from source
cd node && git checkout v0.10.26-release
make && sudo make install

sudo npm install -g bower
sudo npm install -g grunt-cli
sudo npm install -g yo

Before we can install mean.js, we need to install and start MongoDb.

# Add the mongo repository information and update
sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
# Install Mongo
sudo apt-get -y install mongodb-org

Next, let’s scaffold our mean.js application with Yeoman

sudo npm install -g generator-meanjs
cd .. && mkdir myNewMeanProject
cd myNewMeanProject
yo meanjs
# Start your MEAN server on port 3000

Now, your server should be up and running with a mean.js default project! You can view your website by visiting

If you just want your website to run on port 80, the default http port, edit the ‘/server/config/env/all.js’ file and change this line

	port: process.env.PORT || 3000,

to this

	port: process.env.PORT || 80,


  1. I think you missed one:

    npm install -g yo

    • Awesome, thanks Will. I’ve edited the code to reflect this change.

  2. it doesn’t work for me 🙁
    I’m trying to install everything from scratch, have a fresh new instalation od ubuntu 14.04 and after “yo meanjs” it fails.

    for example this is first error:

    Error: EACCES, mkdir ‘/home/aleksandar/.npm/fs-extra/0.9.1’
    npm ERR! { [Error: EACCES, mkdir ‘/home/aleksandar/.npm/fs-extra/0.9.1’]
    npm ERR! errno: 3,
    npm ERR! code: ‘EACCES’,
    npm ERR! path: ‘/home/aleksandar/.npm/fs-extra/0.9.1’,
    npm ERR! parent: ‘grunt-mocha-test’ }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

  3. Thanks for the great tutorial.

    But after I have all installed and started yo meanjs, I get a EACCESS.
    Under Ubuntu 14.04 I have to do this to run without errors:
    sudo chown ubuntu /home/ubuntu/tmp -Rv

    Now my question: how can I run the grunt on a server without any output. Like: service apache2 start


Submit a Comment

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