Skip to content

Instantly share code, notes, and snippets.

@kaisargaming
Forked from mcnamee/npm-cloudlinux.md
Created July 2, 2019 15:39
Show Gist options
  • Save kaisargaming/7afcec2f02933f88dc7f2053f3bb38b0 to your computer and use it in GitHub Desktop.
Save kaisargaming/7afcec2f02933f88dc7f2053f3bb38b0 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_6.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