###The technologies in this post have since been updated. This post may not contain relevant information.

This post is written under the consideration that you do not have any dependencies installed for any software in the MEAN stack.

We will begin by installing Git, which we will use to pull down Mean.io.

sudo apt-get install git

Next, we’re going to install Node.js, the server that will run the MEAN stack. To make sure we have the most up-to-date version of Node.js, we will be adding a repository to Ubuntu.

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

It’s great that Node.js is installed, but now we have to configure it to allow global installations of packages like Bower or Grunt. We’re going to tell Node Packager Manager to install packages to a hidden folder in our home directory. Then we’re going to append a line to the bottom of our .bashrc file that adds that hidden folder to our path. After we reload .bashrc, we will also install grunt so we can build the code provided by Mean.io.

echo prefix = ~/.node >> ~/.npmrc
echo "export PATH=\$HOME/.node/bin:\$PATH" >> .bashrc
source ~/.bashrc
npm install -g grunt-cli

Now we need to install MongoDB. First we need to add a key to APT to verify the MongoDB install. Then we create a listing for MongoDB in the sources list. After that we’ll refresh the repository and install MongoDB. Let’s start MongoDB as well.

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
sudo apt-get install mongodb-10gen
sudo service mongodb start

Here’s the fun bit. Now we’re going to clone Mean.io in Git, install it using NPM, and launch Node.js using Grunt.

git clone https://github.com/linnovate/mean ~/mean
cd ~/mean
npm install
grunt

Congratulations! The MEAN stack should now be running. Just point your browser to YOUR-IP-HERE:3000 and enjoy.

References: