Skip to content

Instantly share code, notes, and snippets.

@cloudz
Forked from mcnamee/npm-cloudlinux.md
Created March 9, 2020 20:10
Show Gist options
  • Save cloudz/af9df60d545a5e24074c800fde7edf61 to your computer and use it in GitHub Desktop.
Save cloudz/af9df60d545a5e24074c800fde7edf61 to your computer and use it in GitHub Desktop.
Install Node / NPM into CloudLinux

How to install Node.js & NPM on CentOS with CloudLinux and CageFS

Add node.js yum repository

yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_13.x | sudo -E bash -

Install node.js and NPM

yum install nodejs

Verify versions

node -v

Make the files accessible for all users

ln -s /usr/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
cp /usr/bin/node /usr/local/bin/node

Tell CageFS that Node and NPM are allowed

Node:

nano /etc/cagefs/conf.d/node.cfg

With contents:_

[node]
comment=Node
paths=/usr/local/bin/node

NPM:

nano /etc/cagefs/conf.d/npm.cfg

With contents:_

[npm]
comment=NPM
paths=/usr/local/bin/npm

Update CageFS

cagefsctl --force-update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment