Installing Node.js on Ubuntu is exceptionally easy. We are going to install Node into our home directory so that we do not need to use sudo during development.
Create a directory structure to store locally installed packages.
mkdir -p ~/opt/packages && cd $_
Change the version numbers below as new versions of Node are released.
Download the node.js package.
Unzip the package.
gzip -dc node-v0.10.25-linux-x64.tar.gz | tar xf -
Create a symlink to the currently installed version. We can change the symlink in the future to easily upgrade our node version.
ln -s ~/opt/packages/node-v0.10.25-linux-x64/ ~/opt/node
Add node to your PATH.
Write the following in your .profile file:
# include locally installed packages in PATH if [ -d "$HOME/opt" ]; then PATH="$PATH:$HOME/opt/node/bin" fi
.profile file and test Node.
Ensure that the node command is in your PATH.
Check the node version.
You should see: v0.10.25.
Check the npm version.
You should see: 1.3.24.
We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.
All courses are made with love in
Palo Alto, CA.
Subscribe to our newsletter