How to setup nodejs on Centos 6 machine in 5 seconds
Quick and not so dirty way of setting up nodejs on a Centos machine without using packages, which are usually out of date and you need to add the EPEL repo. I'm not a node guy but I don't believe this is the recommended way of putting anything in production, but it's good for quick tests on VPSs, Vagrant machines and the like.
Just run the whole thing bellow, adjust the user name if you want, it's just a suggestion to avoid running as root.
# Create a new, non-root user
adduser node
echo "node ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
su - node
# Install git
sudo yum install git
# Install node.js through nave
cd ~
mkdir .nave
cd .nave
wget https://raw.github.com/isaacs/nave/master/nave.sh
sudo chmod +x nave.sh
sudo ln -s $PWD/nave.sh /usr/local/bin/nave
cd ~
nave install 0.10.15
nave use 0.10.15
node -v
After that, just clone your app repo and have fun:
# Run sample app
git clone <your node application repo>
cd my-node-app
npm install
node start-file.js
Written by Rafael Rosa Fu
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Setup
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#