Installing NodeJS on Linux Without using Sudo

Installing NodeJS on Linux Without using Sudo. There a few different ways you can install node.

“Software that you compile yourself should not go into /usr, it should go into your home directory. This is part of being a software developer.”

# take ownership of the folders that npm/node use

# please don't do this if you don't know what it does!
sudo mkdir -p /usr/local/{share/man,bin,lib/node,include/node}
sudo chown -R $USER /usr/local/{share/man,bin,lib/node,include/node}

# now just a pretty vanilla node install
# let it use the default paths, but don't use sudo, since there's no need
cd ~
mkdir node-install

curl | tar -xzf - -C node-install

cd node-install/*
./configure --without-ssl
make install

# now the npm easy-install
curl | sh

This way took over 5 minutes to complete.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh