Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

How can I install Node.js and MongoDB so they are the most current versions? The available versions from package manager are not up to date, and PPA from Chris Lea for Node.js doesn't get updated on a regular basis.

share|improve this question

2 Answers 2

up vote 18 down vote accepted

The packages in the Advanced Packaging Tool (AptGet) do not work always or are outdated at times on Ubuntu. I suggest building Node.js from source and installing the recommended .deb package for Ubuntu provided by MongoDB.

Video Demo:


These are needed for building and running.

sudo apt-get install build-essential lamp-server^

Build & Install Node.js

Node.js can easily be installed from its source package located on the front page of It allows you to build the most compatible package for install.

Note: I recommend not installing the Linux Binaries for your system architecture (ie. x32, x64) as they are missing components you may require such as NPM.

Node.js Front Page

You can right click on the INSTALL button to copy the source package link and do the following also in your terminal console.(Example shows how to install current version as of 07-31-2014)


Decompress and enter the directory.

tar -xvzf node-v0.10.30.tar.gz
cd node-v0.10.30

Configure the make file for your machine then build and install as a root user.

sudo make install

Test to make sure it was installed.

node -v

You have also installed the Node Package Manager. Type the following to see items that were installed with version numbers:

npm version

Install Recommended MongoDB Package

MongoDB documentation suggest installing the .deb package provided by them for the latest versions as long as you are using running and Ubuntu over 9.10 "Karmic". Doc: Installing on Ubuntu

Acquire key:

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10

Acquire source list:

echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

Update package manager and install:

sudo apt-get update && sudo apt-get install mongodb-org

Test if MongoDB shell runs:


Press Ctrl+C to exit.

Note: mongo-10gen can be updated and upgraded from AptGet. You do not need to perform the install action again unless you remove it.

share|improve this answer
I also want to add the reference to 'How do I install the latest version of node.js?' suggest that the official PPA is the one from Chris Lea. This is incorrect but it has been the most reliable one as of yet. This is why updates fall behind because people must wait for him to have time to get to updating it. – Brandon Clark Aug 13 '13 at 13:56
You can download the latest node binaries using: wget$(curl -s | egrep -io "\"node-v.*-linux-x64.tar.gz\"" | sed "s/\"//g”) – Engineer Dollery Mar 30 at 14:32
@EngineerDollery Are those always stable? – Brandon Clark Mar 30 at 16:10
I don't know if it's guaranteed or not -- you'd have to ask the node guys, but I can't find any evidence that they're not stable. There is a nightlies dist too. – Engineer Dollery Mar 30 at 16:29
@EngineerDollery Okay definitely not then. But this is good info for those who want to start focusing on ES6 development in node. I will try and update the answer with your suggestion. – Brandon Clark Mar 30 at 16:39


The current version of node.js on ubuntu is 0.10, where 0.12 is stable. You can upgrade via the built-in n command as

sudo npm cache clean -f
sudo npm install -g n
sudo n stable


MongoDB has updated its repositories to To install

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo "deb trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

(except if you use 12.04, in which case replace trusty, but this line works in vivid, for example, and you can skip the keyserver... step if you had a previous MongoDB-install and just do a update and dist-upgrade)

References: Node.js and MongoDB

share|improve this answer
@karel: When I ran it, it seemed to also upgrade npm automatically. Maybe I did not check enough. Do you have any references of this not working?… did not explicitly mention the need to upgrade npm separately, either. In addition, the 3.3.1 page of npm says: "You need node v0.8 or higher to run this program." -- so that is correct at node versions less than 8. What do you think should be added? – user Sep 1 at 8:41
I was mistaken. According to the command sudo npm install -g n should work. – karel Sep 1 at 9:31
@karel: Thank you for the feedback – user Sep 1 at 10:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.