OK. The article here covers this pretty well:
https://www.digitalocean.com/community/tutorials/how-to-set-up-xhprof-and-xhgui-for-profiling-php-applications-on-ubuntu-14-04
But I found a couple of points could be better.
Procedure:
Install the prerequisites.
Install xhprof and php5-xhprof using apt – not using PECL. No real reason – I just prefer to use apt if possible.
Install the mongo database server as instructed – but – when installing the PHP module for Mongo install the mongodb module and not the mongo module. Otherwise the script to create the XHGUI site will fail.
Then follow the other points in the Digital Ocean document.