How to install mean.io from scratch on Ubuntu 12.04

A quick note: Before choosing mean.io for your next project, you should be aware of this article by Amos Haviv, the former lead devloper at mean.io. The article explains that mean.io was being forced into a commercial product, which prompted the creation of mean.js, an open-source fork by two founding developers that to date has much better community support and documentaion. I wrote a guide to installing mean.js from scratch on Ubuntu here, if you’d rather do that.

All that aside, here’s how to install mean.io 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 https://github.com/joyent/node.git
# Configure, make and install from source
cd node && git checkout v0.10.26-release
./configure
make && sudo make install

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

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

# Add the mongo repository information and update
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart 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 set up our mean.io tool and first project.

# Install the mean.io tool
sudo npm install -g meanio
# Create your new project
mean init myNewMeanProject
# Install dependencies with npm and bower
cd myNewMeanProject
sudo npm install
bower update
# Start your MEAN server on port 3000
grunt

Now, your server should be up and running with a mean.io default project! You can view your website by visiting http://mywebsite.com:3000

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,

3 Comments

  1. it works!!!
    thanks 🙂

    Reply
  2. This is brillliant! I was struggling with it the whole day and your post just helped me complete the installation in 10 mins! Awesome! Thanks a ton!

    Reply
  3. Does not work. Followed the exact procedure, and I end up with a error that says it could not find local grunt.

    Reply

Submit a Comment

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