Running FreePBX Node.js services on RHEL 6

This was a bit of a challenge because FreePBX expects certain minimum versions of nodejs, and then tries to build modules that require a C++ version 11 compiler. As usual, tracking down all the info I needed took longer than doing the actual install:

# Get the repo for the C++ compiler and assembler
wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
# Install the C++ compiler and assembler
yum -q -y install 'devtoolset-2-gcc-c++' 'devtoolset-2-binutils'
# Ensure the new compiler and assembler are enabled by default
echo 'source scl_source enable devtoolset-2' > /etc/profile.d/devtoolset-2.sh
# Get the repo for Node
wget -qO- https://rpm.nodesource.com/setup_11.x | bash -
# Install Node
yum -q -y install nodejs
# If you've already installed FreePBX 14, you'll need to re-install the UCP module that uses Node
fwconsole ma downloadinstall ucp
# If you've already installed FreePBX 15, you'll need to reinstall the core so the FastAGI server works
fwconsole ma downloadinstall core

# Get the repo for the C++ compiler and assembler wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo # Install the C++ compiler and assembler yum -q -y install 'devtoolset-2-gcc-c++' 'devtoolset-2-binutils' # Ensure the new compiler and assembler are enabled by default echo 'source scl_source enable devtoolset-2' > /etc/profile.d/devtoolset-2.sh # Get the repo for Node wget -qO- https://rpm.nodesource.com/setup_11.x | bash - # Install Node yum -q -y install nodejs # If you've already installed FreePBX 14, you'll need to re-install the UCP module that uses Node fwconsole ma downloadinstall ucp # If you've already installed FreePBX 15, you'll need to reinstall the core so the FastAGI server works fwconsole ma downloadinstall core

You should be able to confirm everything installed ok like so:

node --version
npm --version
fwconsole pm2 --list

node --version npm --version fwconsole pm2 --list

And you should see something like this:

$ node --version
v11.12.0
$ npm --version
6.7.0
$ fwconsole pm2 --list
+--------------+-------+--------+----------+---------------------+-----+---------+
| Process Name | PID   | Status | Restarts | Uptime              | CPU | Mem     |
+--------------+-------+--------+----------+---------------------+-----+---------+
| core-fastagi | 25667 | online | 1        | 12 hours, 5 minutes | 0%  | 12.09MB |
| ucp          | 25025 | online | 1        | 12 hours, 7 minutes | 0%  | 33.86MB |
+--------------+-------+--------+----------+---------------------+-----+---------+

$ node --version v11.12.0 $ npm --version 6.7.0 $ fwconsole pm2 --list +--------------+-------+--------+----------+---------------------+-----+---------+ | Process Name | PID | Status | Restarts | Uptime | CPU | Mem | +--------------+-------+--------+----------+---------------------+-----+---------+ | core-fastagi | 25667 | online | 1 | 12 hours, 5 minutes | 0% | 12.09MB | | ucp | 25025 | online | 1 | 12 hours, 7 minutes | 0% | 33.86MB | +--------------+-------+--------+----------+---------------------+-----+---------+