Skip to content

Building PM2

aborkar-ibm edited this page May 14, 2019 · 56 revisions

Building PM2

The instructions provided below specify the steps to build PM2 latest version on Linux on IBM Z for following distributions:

  • RHEL (6.10, 7.4, 7.5, 7.6)
  • SLES (12 SP4, 15)
  • Ubuntu (16.04, 18.04 , 19.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Step 1: Installing PM2

1.1) Install dependencies

  • RHEL 6.10

    sudo yum install wget tar make gcc gcc-c++ binutils-devel bzip2
    • Build GCC 4.8.2
      export SOURCE_ROOT=/<source_root>/
      cd $SOURCE_ROOT
      wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
      tar -xvjf gcc-4.8.2.tar.bz2
      cd gcc-4.8.2/
      ./contrib/download_prerequisites
      cd $SOURCE_ROOT
      mkdir gccbuild
      cd gccbuild/
      ../gcc-4.8.2/configure --prefix=$HOME/install/gcc-4.8.2 --enable-shared --disable-multilib --enable-threads=posix --with-system-zlib --enable-languages=c,c++
      make
      sudo make install
      export PATH=$HOME/install/gcc-4.8.2/bin:$PATH
      export LD_LIBRARY_PATH=$HOME/install/gcc-4.8.2/lib64:$LD_LIBRARY_PATH
  • RHEL (7.4, 7.5, 7.6)

  sudo yum install wget tar 
  • SLES (12 SP4, 15)
  sudo zypper install wget tar 
  • Ubuntu(16.04, 18.04, 19.04)
  sudo apt-get update
  sudo apt-get install wget tar 
  • Install Node.js

    • RHEL(6.10)

      cd $SOURCE_ROOT
      wget https://nodejs.org/dist/v8.2.0/node-v8.2.0-linux-s390x.tar.gz 
      tar -xvf node-v8.2.0-linux-s390x.tar.gz
      mv node-v8.2.0-linux-s390x nodejs
      export PATH=$PATH:$SOURCE_ROOT/nodejs/bin
    • RHEL(7.4, 7.5, 7.6), Ubuntu(16.04, 18.04, 19.04) and SLES(12 SP4, 15)

      export SOURCE_ROOT=/<source_root>/
      cd $SOURCE_ROOT
      wget https://nodejs.org/dist/v9.11.2/node-v9.11.2-linux-s390x.tar.gz
      tar -xvf node-v9.11.2-linux-s390x.tar.gz
      mv node-v9.11.2-linux-s390x nodejs
      export PATH=$SOURCE_ROOT/nodejs/bin:$PATH

1.2) Install PM2

npm install pm2 -g	

Step 2: Verification(Optional)

2.1) Create a file app.js

var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Welcome to pm2\n");
});
server.listen(8080);
console.log("Server running at http://127.0.0.1:8080/");

2.2) Run the application

pm2 start app.js

Note: The application server will be started and serving at http://127.0.0.1:8080/.

2.3) Monitor the application

pm2 monit

References:

http://pm2.keymetrics.io/

Clone this wiki locally