Installing node with apt-get or downloading the Linux Binaries (.tar.gz)
What is the difference between installing node.js with 'sudo apt-get install nodejs' or downloading the Linux Binaries (.tar.gz) and following these instructions?
Is the outcome the same?
Solution 1:
Installing from source has one pitfall, that removing (and otherwise keeping track of installed files) becomes difficult. It's best to let the package manager handle the installation. You can use this PPA and then apt-get
will get you the latest version.
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
The PPA has since been moved to another source. The instructions from the NodeJS Github wiki:
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
The commands, condensed out from the script:
sudo apt-get install apt-transport-https lsb-release curl
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
sudo sh -c "echo 'deb https://deb.nodesource.com/node $(lsb_release -sc) main' > /etc/apt/sources.list.d/nodesource.list"
sudo sh -c "echo 'deb-src https://deb.nodesource.com/node $(lsb_release -sc) main' >> /etc/apt/sources.list.d/nodesource.list"
sudo apt-get update
sudo apt-get install nodejs
Solution 2:
There are a few differences
The version available for Ubuntu is made for Ubuntu, and will include/depend on any extra packages needed, and may have specific configuration for Ubuntu
The version for Ubuntu can just be installed using apt - the tar.gz from the nodejs will need to be configured.
- The version from the nodejs site will be more up-to-date (currently v0.10.30 on their site compared to v0.10.25 from the Ubuntu repos)
Note you can use a PPA to get a more up-to-date version - e.g. this one.