pm2-logrotate install on offline linux machine

1.3k Views Asked by At

I want to install pm2-logrotate on linux machine where the machine is not having internet connectivity

https://www.npmjs.com/package/pm2-logrotate

3

There are 3 best solutions below

0
onerinas On
pm2 install pm2-logrotate-2.7.0.tgz
1
Zero On

To make an offline installer, you need to make your own tar.gz file.

First, you need to download the Source code (tar.gz) from Pm2 GitHub

Extract the tar.gz file and this will create a folder with the source inside

Rename the main folder (normally named pm2-logrotate-2.7.0) to module and create the pm2-logrotate-2.7.0.tar.gz file again with the module folder

The struct of the files inside of the tar.gz will be something like:

module
|- .gitignore
|- CHANGELOG.md
|- README.md
|- app.js
|- node_modules
|- package-lock.json
|- package.json
|- pres
|- test

Then you can use the command pm2 install pm2-logrotate-2.7.0.tar.gz without getting errors

0
gkfonline On

1.Download source code tar.gz pm2-logrotate

2.Install modules in code, Copy code to the same server environment(in network)

tar -xzvf pm2-logrotate-2.7.0.tar.gz
cd pm2-logrotate-2.7.0/
npm install
tar -czvf pm2-logrotate.tar.gz pm2-logrotate-2.7.0

3.Copy pm2-logrotate.tar.gz to offline server to .pm2/modules

cd ~/.pm2/modules/
tar -xzvf pm2-logrotate.tar.gz
pm2 module:generate pm2-logrotate
cd pm2-logrotate
pm2 install .

4.Add conf in to .pm2/module_conf.json

{ 
   "pm2-logrotate": {
        "max_size": "10M",
        "retain": "30",
        "compress": false,
        "dateFormat": "YYYY-MM-DD_HH-mm-ss",
        "workerInterval": "30",
        "rotateInterval": "0 0 * * *",
        "rotateModule": true
    },
    "module-db-v2": {
        "pm2-logrotate": {}
    }

}

Run pm2 conf pm2-logrotate can see pm2-logrotate config

Reset conf

pm2 set pm2-logrotate:max_size 100M