The problem is, on Ubuntu you cannot simply run

apt-get install dmd

to install D compiler. I hope they add it to official repositories someday but till then you can try this:

First you will need to download appropriate .deb file from D official website: link

Then:

apt-get install gdebi-core

sudo gdebi dmd_2.070.0-0_amd64.deb

Then you can compile any .d source file using

dmd file1.d