I recently published a blog post on how to set-up HHVM in a virtual machine. Since the latest HHVM release a few things changed within HHVM and you won't be able to install HHVM that way. This blog post will give you some insights on how to install the current version of HHVM.
First of all let's set-up a VM with Debian 7 via vagrant:
Vagrant.configure("2") do |config|
config.vm.define "box" do |box_cfg|
box_cfg.vm.box = 'debian-wheezy'
box_cfg.vm.box_url = 'https://dl.dropboxusercontent.com/u/86066173/debian-wheezy.box'
box_cfg.vm.hostname = "hhvm"
# Forward a port from the guest to the host
box_cfg.vm.network :forwarded_port, guest: 80, host: 8080
# share folder to the guest VM
box_cfg.vm.synced_folder ".", "/vagrant", owner: "www-data", group: "vagrant"
Installing hhvm on a Debian Wheezy box is pretty straight forward. Since the "official" hhvm binaries do not contain a webserver anymore we need to install any webserver with Fast-CGI support. In this case we go for nginx. It boils down to the following commands which you need to execute as root user:
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add -
echo deb http://dl.hhvm.com/debian wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
apt-get install hhvm-fastcgi nginx
Now we need to configure Fast-CGI support of nginx and point it to the local hhvm installation. The hhvm folks ship an installer for that purpose to make it really easy for us to set things up. Just run the following commands as root user:
sudo /etc/init.d/nginx restart
sudo /etc/init.d/hhvm restart
Last not least we create an index.php file which should be served by hvvm. Create the file in /usr/share/nginx/www. Let's go for a simple "Hello world!" script like this:
echo "Hello world!";
That's all we need. Now point your webbrowser to http://localhost:8080/index.php and you should be able see the "Hello world!" greeting. That was easy ;)