How to install latest version of Node.js on Ubuntu ?
In most of the repositories the Node.js package is included within the repository itself. You can install using package manager such as
Most of the time the Linux distro repository don’t have latest version of the Node.js.
If you have installed latest version of Ubuntu, you would have observed that the Node.js version is still 0.6.x. Now a days all Node.js applications are using latest version due to enriched features of Node in the latest version.
Below steps will help you to get the latest version of Node.js on your Ubuntu distro.
Checking and Removing Previous version of Node.js
Check if you have already Node.js installed on your Linux by running below command -
If Node.js is already installed you will see node version something like 0.6.x. To install latest version of node you need to remove the nodejs which is already installed. Use below command to remove
sudo apt-get remove nodejs
Configuring Package Manager
Couple of other packages will be required to install the Nodejs. So make sure you have Universe enabled in your sources.list file.
sudo nano /ect/apt/sources.list deb http://archive.ubuntu.com/ubuntu/ quantal main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ quantal-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ quantal-updates main restricted universe multiverse
Once you enabled Universe in sources.list, you need to update the package manager by running
sudo apt-get update
Installation of Node.js
We will get the latest version of Node.js using Personal Package Manager (ppa), so you first need to get the personal package manager and then update the package indexes.
sudo apt-get install python-software-properties sudo add-apt-repository ppa:richarvey/nodejs sudo apt-get update sudo apt-get install nodejs
If everything goes well, you will have latest version of Node.js installed on your Ubuntu. You can check by running below command on your terminal.