Building and installing HHVM on RHEL 7

orcuspl edited this page Apr 27, 2016 · 4 revisions

We are not using sudo in this guide. Do it yourself or just be root here, for a short while.

Prepare

Make sure that you have rhel-7-server-optional-rpms repository enabled as several of the required packages are there.

subscription-manager repos --enable=rhel-7-server-optional-rpms

Packages for building

yum install git svn cpp make autoconf automake libtool patch memcached \
bzip2 gcc-c++ cmake wget boost-devel mysql-devel pcre-devel gd-devel \
libxml2-devel expat-devel libicu-devel bzip2-devel openldap-devel \
libedit-devel libcap-devel binutils-devel pam-devel elfutils-libelf-devel \
libcurl-devel libmemcached-devel tbb-devel libdwarf-devel \
ImageMagick-devel libxslt-devel ocaml libevent-devel libyaml-devel \
readline-devel libzip-devel sqlite-devel gmp-devel gperf

Some of the packages are not found in RHEL repositories, so you need to install them from sources yourself.

Google Glog

cd /opt
wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz &&
tar xvzf glog-0.3.3.tar.gz && cd glog-0.3.3 &&
./configure && make && make install

Oniguruma

cd /opt
wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.5.tar.gz &&
tar xvzf onig-5.9.5.tar.gz && cd onig-5.9.5 &&
./configure && make && make install

or

cd /opt
wget https://github.com/kkos/oniguruma/releases/download/v5.9.6/onig-5.9.6.tar.gz &&
tar xvzf onig-5.9.6.tar.gz && cd onig-5.9.6 &&
./configure && make && make install

Mcrypt

cd /opt
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz &&
tar zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8 &&
./configure && make && make install

Jemalloc

cd /opt
wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2 &&
tar jxvf jemalloc-3.6.0.tar.bz2 && cd jemalloc-3.6.0 &&
./configure && make && make install

LZ4

cd /opt
wget https://github.com/Cyan4973/lz4/archive/r124.tar.gz &&
tar zxvf r124.tar.gz && cd lz4-r124 &&
make && make install PREFIX=/usr/local

Getting HHVM source code and building

cd /opt
git clone git://github.com/facebook/hhvm.git --depth=1
export CMAKE_PREFIX_PATH=`pwd`
cd hhvm
git submodule update --init --recursive
cmake .
make # Add -jN, with N being numcores+1 to maximize build performance.
make install

RHEL Service Daemon

To have HHVM start as a system daemon process on RHEL once you have complied HHVM you will want to create an HHVM service. Below you will find an example of a systemd file. This will allow you to start HHVM as a daemon by issuing service start and stop commands and enable HHVM to be run on boot.

Please note a config file needs to exist at /etc/hhvm/server.ini, and username for HHVM is nginx or apache depending on which http server you have installed. This can be changed in the /usr/lib/systemd/system/hhvm.service script file to match your setup.

hhvm.service

[Unit]
Description=HipHop Virtual Machine

[Service]
ExecStart=/usr/local/bin/hhvm -m daemon -u nginx -c /etc/hhvm/server.ini
ExecStop=rm /var/run/hhvm.pid
PIDFile=/var/run/hhvm.pid

[Install]
WantedBy=multi-user.target

Start HHVM

systemctl start hhvm

Enable HHVM on boot

systemctl enable hhvm
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.