Skip to content
July 6, 2015 / windperson

Create Node.js latest verion RPM installer for CentOS 6&7

Since the node.js RPM installer in EPEL repository is old (v0.10.x), we can use “nodejs-rpm” to installable rpm package:

  1. Install necessary packages:
    • CentOS v7.x:
      sudo yum install -y gcc-c++ git make openssl-devel yum-utils rpmdevtools
    • CentOS v6.x:
      It need to install Python v2.7 and new version of GCC C++ compiler if you want to build Node.js v4.x RPM packages, and install following requirements:

      sudo yum install -y git openssl-devel yum-utils rpmdevtools
  2. Use git to get latest source of nodejs-rpm in Github:
    git clone https://github.com/kazuhisya/nodejs-rpm.git
  3. Use yum-builddep to config necessary rpm packages:
    cd nodejs-rpm;sudo yum-builddep -y ./nodejs.spec
  4. Build rpm package:
    • CentOS v6.x:
      scl enable python27 devtoolset-3 'make rpm'
    • CentOS v7.x:
      make rpm

The final rpm package files will place in nodejs-rpm/dist/ folder as:

  • CentOS v6.x:
    CentOS 6.x build node.js rpm result
  • CentOS v7.x:
    CentOS 7.x build node.js rpm result

Install as:
(Replace the [version] with current release node.js version number)

  • CentOS v6.x:
    sudo yum install -y nodejs-[version].el6.x86_64.rpm nodejs-npm-[version].el6.x86_64.rpm --nogpgcheck
    
  • CentOS v7.x:
    sudo yum install -y nodejs-[version].el7.x86_64.rpm nodejs-npm-[version].el7.x86_64.rpm --nogpgcheck
    
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: