Building PM2 - linux-on-ibm-z/docs GitHub Wiki

Building PM2

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

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.10)

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.

Note: PM2(v5.3.1) was verified at the time of creation of these instructions

Step 1: Install PM2

1.1) Install dependencies

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
  sudo yum install -y wget tar xz
  • SLES 12 SP5
  sudo zypper install -y wget tar xz npm14
  • SLES 15 SP5
  sudo zypper install -y wget tar xz npm16
  • Ubuntu(20.04, 22.04, 23.10)
  sudo apt-get update
  sudo apt-get install -y wget tar xz-utils
  • Install Node.js (For RHEL 7.x, 8.x, 9.x and Ubuntu 20.04, 22.04, 23.10)
  export SOURCE_ROOT=/<source_root>/
  cd $SOURCE_ROOT
  wget https://nodejs.org/dist/v17.5.0/node-v17.5.0-linux-s390x.tar.xz
  tar xf node-v17.5.0-linux-s390x.tar.xz
  mv node-v17.5.0-linux-s390x nodejs
  export PATH=$SOURCE_ROOT/nodejs/bin:$PATH

1.2) Install PM2

  npm install pm2 -g           # For RHEL(7.x, 8.x, 9.x) and Ubuntu(20.04, 22.04, 23.10)
  sudo npm install pm2 -g      # For SLES(12 SP5, 15 SP5)

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