Skip to content

Building and installing hhvm on CentOS 7.x

Ilya Otyutskiy edited this page Jul 24, 2015 · 62 revisions

Prepare

We are not using sudo here because it makes the columns so long. Do it yourself or just be root here, for a short while.

First of all, you need the EPEL repositories:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Then get some development packages:

# Use bash brace extension here or the list would be really frightening
yum install cpp gcc-c++ cmake git psmisc {binutils,boost,jemalloc}-devel \
{ImageMagick,sqlite,tbb,bzip2,openldap,readline,elfutils-libelf,gmp,lz4,pcre}-devel \
lib{xslt,event,yaml,vpx,png,zip,icu,mcrypt,memcached,cap,dwarf}-devel \
{unixODBC,expat,mariadb}-devel lib{edit,curl,xml2,xslt}-devel \
glog-devel oniguruma-devel ocaml gperf enca libjpeg-turbo-devel openssl-devel \
make

If you decided to use clang instead of gcc/g++ stuffs, replace gcc-c++ with clang-devel (of cource you can install both.) clang uses less memory and time to build hhvm.

CentOS 7.x uses mariadb as the default mysql compatible package, not oracle's MySQL product.

If you are using MariaDB, you will need to install and start it in order for cmake to find the socket file.

yum install mariadb-devel -y
service mariadb start

Grab the Source

cd /tmp
git clone https://github.com/facebook/hhvm -b master  hhvm  --recursive
cd hhvm

Then build it!

# ./configure # That is a cmake wrapper, ignore it.
cmake .
make -j$(($(nproc)+1)) # make with CORE_COUNT+1 threads, that would be fast. You may run out of RAM
# Test..
./hphp/hhvm/hhvm --version
# Install it..
sudo make install

If you are using clang, add these to the cmake options:

-DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_{C,ASM}_COMPILER=/usr/bin/clang

HELP NEEDED in this chapter

This hasn't been tested with clang

Add HHVM to services

Add these to /usr/lib/systemd/system/hhvm.service:

[Unit]
Description=HHVM HipHop Virtual Machine (FCGI)
 
[Service]
ExecStartPre=-/usr/bin/mkdir -p /var/run/hhvm
ExecStartPre=-/usr/bin/chown nobody /var/run/hhvm
ExecStart=/usr/local/bin/hhvm --config /etc/hhvm/server.ini --user nobody --mode daemon -vServer.Type=fastcgi -vServer.Port=9000
 
[Install]
WantedBy=multi-user.target

And do some systemctl work to make it start automatically:

systemctl enable hhvm
systemctl start hhvm
systemctl status hhvm
Clone this wiki locally