Install HHVM on ubuntu/linux

HipHop was facebook's attempt to make php faster. They tried to convert source code parts to native machine code, which worked quite well. Now they work on another (but quite related) approach called hhvm (hiphop virtual machine), which is even nicer. I installed it on a ubuntu vm and it runs like a charm.

First check your ubuntu version using the following command:

lsb_release -a

It will return something like this:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily

Then you can add the repository. I have to select the code for 15.10:

# installs add-apt-repository
sudo apt-get install software-properties-common

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install hhvm

For other versions take a look at the official documentation.

Now you can run your command line scripts like this:

hhvm somescript.php