Building CyanogenMod requires quite a lot of work. You will need to install a large number of dependencies, and you will need to read through lots of documentation.
Docker is a rather new software to automate the deployment of applications inside a software container.
Here is a Docker container for running an environment which contains everything that is needed to compile CyanogenMod. It will be very easy to install, and it will just work! The Github page contains some further information on how to get started.
NOTE: You will need to install Docker to proceed: https://www.docker.io/gettingstarted/
How to run:
git clone https://github.com/stucki/docker-cyanogenmod.git cd docker-cyanogenmod ./run.sh
repo init -u git://github.com/CyanogenMod/android.git -b staging/cm-12.1 repo sync source build/envsetup.sh brunch <device codename> # example: brunch grouper
Github URL: https://github.com/stucki/docker-cyanogenmod
Any feedback is welcome. Enjoy!