Install Node.js on Ubuntu Server With PPA

• 1 min read

Here is a quick tip that would have saved me a couple of hours while installing Node.js on Ubuntu Server 12.04. I wanted to install Node from a repository instead of a tarball for convenience but couldn’t figure out why apt-get wasn’t giving Node v0.6.* instaed of v0.8.*. I followed the official tutorial which tells you to do the following:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

What I did not know, however, was that there already existed a package by the name on nodejs, so by default the last command was installing the more “stable” version. To find out what versions of nodejs are available, you can type the following:

sudo apt-cache show nodejs

To install the latest one, simply append the version to the package name separated by an “=” sign.

# Your version may be different
sudo apt-get install nodejs=0.8.18-1chl1~precise1

I hope this helped you avoid the head smashing frustrations that I went through during this process. Time to hack! :)

P.S. The same thing applies when installing NPM as well.

If you enjoyed this tutorial, please consider sponsoring my work on GitHub 🤗

Be the first to cheers
Now look what you've done 🌋
Stop clicking and run for your life! 😱
Uh oh, I don't think the system can't handle it! 🔥
Stop it, you're too kind 😄
Thanks for the love! ❤️
Thanks, glad you enjoyed it! Care to share?
Hacker News Reddit

×

Recommended Posts ✍🏻

See All »
• 3 min read
✨ HTML Share Buttons
Read Post »
• 3 min read
🚅 Next Stop, Yaak
Read Post »
• 4 min read
💻 Wait for User to Stop Typing, in JavaScript
Read Post »