It's possible, but it can be a bit of a pain if you've never done it before. It's the way that the official binaries are built.
On the plus side, it's
very well documented here.
If you're starting with an existing Ubuntu system, you can skip down to
"Setting up Debian for gitian building". This particular section needs a few changes for Ubuntu (it was originally written for Debian 7.4). Specifically, the apt-get line should read:
sudo apt-get install apt-cacher-ng git python-vm-builder ruby1.9.1 lxc
Don't run the "adduser debian sudo" line. The "set up LXC and the rest with the following, which is a complex jumble of settings and workarounds" section is partly unnecessary, and it should instead look like this for Ubuntu:
# the version of lxc-start in Ubuntu needs to run as root, so make sure
# that the build script can execute it without providing a password
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-execute" | sudo tee /etc/sudoers.d/gitian-lxc >/dev/null
sudo chmod 440 /etc/sudoers.d/gitian-lxc
# make sure that USE_LXC is always set when logging in,
# and configure LXC IP addresses
echo 'export USE_LXC=1' >> ~/.profile
echo 'export LXC_GUEST_IP=10.0.3.5' >> ~/.profile
echo 'export GITIAN_HOST_IP=10.0.3.1' >> ~/.profile
echo 'export LXC_BRIDGE=lxcbr0' >> ~/.profile
The section which talks about manually installing python-vm-builder can be ignored.
The rest of this document should work on Ubuntu.
One important note: if you're running this on a fully updated Ubuntu 14.04 system, it won't work due to
a bug (see here). I think it should work on most previous releases of Ubuntu, or on an unupdated version of 14.04 (but not 14.04.1), but I'm not certain of this....
(edited several times...)