If you have a ~/opt directory full of folders like boost, delete that before commencing the following (rather get everything fresh)
cd ~
git clone https://github.com/EOSIO/eos.git
cd ~/eos
git submodule update --init --recursive
./eosio_build.sh
To make the executable programs available (such as eosiocpp) run the following commands
cd ~/eos/build
sudo make install
Once it is installed use the following commands to run the unit tests
~/opt/mongodb/bin/mongod -f ~/opt/mongodb/mongod.conf &
cd ~/eos/build
make test