Installing and running Node.js via Software collections
Software Collections has been introduced by Redhat as a safe way to run selective applications on Redhat based distributions in an isolated environment (separate directory), thus not effecting the base installation of the OS. This provides the possibility to e.g. test an application, install a higher version then the version installed by the base system (e.g. PHP), or temporarily use an application.
Software Collections applications can be started at boot as a system service, manually or in a specific shell.
Node.js requires Python minimum version 2.7. Please see Python SCL installation on how to install Python as a Software Collections Application on SME Server. Once scl-python27 (or scl-python33) is installed and working, you can resume this how-to.
To be able to install an application from the Software Collections, one must install software collections first. Please see Software collections on how to install this.
After installing the scl-nodejs010 repository, Node.js can be installed by issuing the following command:
yum install nodejs010 --enablrepo=scl-nodejs010
Once installed, the application is installed on your SME Server at /opt/rh/nodejs010 as an isolated environment for the application.
Test installed application
Once Python has been installed, you can check if it is correctly installed by issuing:
which will provide you a listing of all applications that are available on your system installed via Software Collections.
A simple man page about the installed application is now available via:
scl enable nodejs010 'man nodejs010'
press 'q' to leave the man page
To make use of Node.js in the current shell environment, one needs to enter the following command:
scl enable nodejs010 bash
and test with:
Enable the Node.js environment at boot time
The preferred way to enable scl nodejs010 permanently at logout or (re)boot is to add a custom script called 'enablenodejs010.sh' to /etc/profile.d/ directory with the following content and make it executable.
#!/bin/sh source /opt/rh/nodejs010/enable export X_SCLS="`scl enable nodejs010 'echo $X_SCLS'`"
Other articles in this category
Software Collections:MongoDB, Software Collections:MariaDB, Software Collections, Software Collections Repositories, Software Collections:PostgreSQL, Software Collections:MySQL55, Software Collections:Nodejs, Software Collections:MySQL, Software Collections:MySQL57, Software Collections:Ruby on Rails, Software Collections:PHP, PHP Software Collections, Software Collections:Python