Skip to content

Instantly share code, notes, and snippets.

@jtallant
Created September 16, 2012 02:57
Show Gist options
  • Select an option

  • Save jtallant/3730855 to your computer and use it in GitHub Desktop.

Select an option

Save jtallant/3730855 to your computer and use it in GitHub Desktop.
Installing Node on CentOS

Installing Node on CentOS

Node requires Python 2.6+

python -V make sure that is a capital V

If you are less than 2.6 then you need to install a newer version of Python but don't worry it's easy.

First off you need to recognize yum’s dependency on Python 2.4. Simply replacing this will break your passing semblance of a package manager. We will be using this later so not breaking is the preferred path. Python versions can live in relative harmony together. Download the Python source and untar it to some directory. I use /opt or ~/source for all of my non-native additions. You can choose whatever you want.

cd /opt
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.1.tgz
cd Python-2.7.1
yum install gcc
./configure
make
make altinstall

The altinstall part is key, as it will resist installing the binary to the default /usr/bin/python path, overriding the needed 2.4 version of Python. On my CentOS installation it put it in /usr/local/bin/python2.7. Now you have a fully functional installation of Python residing happily on your system. It should be accessible by using python2.7 wherever you use python.

Now to install Node

wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm
yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm
yum install nodejs-compat-symlinks npm
rm nodejs-stable-release.noarch.rpm

If the following two commands work then you are good to go
node --version
npm --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment