Skip to content

Instantly share code, notes, and snippets.

@eoboite
Forked from dalekunce/synology_nodejs_install.md
Last active April 12, 2020 11:46
Show Gist options
  • Select an option

  • Save eoboite/91729685a6a4df6415e628d65458a797 to your computer and use it in GitHub Desktop.

Select an option

Save eoboite/91729685a6a4df6415e628d65458a797 to your computer and use it in GitHub Desktop.
Install nodejs on synology box

NodeJS Synology Install Guide

Resources


Login into synology box

ssh username@ipforsynologybox

Switch to root user

sudo su -

Create the optware root directory

enter the following commands:

mkdir /volume1/@optware
mkdir /opt
mount -o bind /volume1/@optware /opt

Set up IPKG:

Run the following commands

feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf

Fix some PATH issues

vi /etc/profile

Add the following line to /etc/profile:

PATH=/opt/bin:/opt/sbin:$PATH
export PATH
vi /root/.profile

Add the following line to /root/.profile:

PATH=/opt/bin:/opt/sbin:$PATH
export PATH

###Reboot Reboot your DiskStation. Do NOT use the "reboot" command, use "reboot -f" or reboot with the DSM GUI.

reboot -f

###Create some local optware stuff Create the /etc/rc.local file and insert:

vi /etc/rc.local
#!/bin/sh

# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start

exit 0

Make it executable

chmod 755 /etc/rc.local

Create the /etc/rc.optware

vi /etc/rc.optware

Insert

#! /bin/sh

if test -z "${REAL_OPT_DIR}"; then
# next line to be replaced according to OPTWARE_TARGET
REAL_OPT_DIR=/volume1/@optware
fi

case "$1" in
   start)
      echo "Starting Optware."
      if test -n "${REAL_OPT_DIR}"; then
         if ! grep ' /opt ' /proc/mounts >/dev/null 2>&1 ; then
            mkdir -p /opt
            mount -o bind ${REAL_OPT_DIR} /opt
         fi
      fi
   [ -x /opt/etc/rc.optware ] && /opt/etc/rc.optware
   ;;
   reconfig)
   true
   ;;
   stop)
      echo "Shutting down Optware."
   true
   ;;
   *)
      echo "Usage: $0 {start|stop|reconfig}"
      exit 1
esac

exit 0

Make it executable

chmod 755 /etc/rc.optware

Update and upgrade ipkg

ipkg update
ipkg ugrade

###Install Git and Node

ipkg install git
cd /root
git clone https://github.com/joyent/node.git
cd node
./configure --prefix=/opt/node
make
make install

If you get a C compiler issue when trying to ./configure fix the c compiler symlink

ln -s /opt/bin/gcc /opt/bin/cc

Try ./configure again

If you get an error talking about GYP

gyp:name 'arm_version' is not defined while evaluating condition 'arm_version==7' in /home/ubuntu/node/deps/v8/tools/gyp/v8.gyp while loading dependencies of /home/ubuntu/node/node.gyp while trying to load /home/ubuntu/node/node.gyp
Error running GYP

Add the following to 'variables' in common.gypi:

'arm_version%' : '1', so it looks like this:

{
  'variables': {
  'werror': '',                    # Turn off -Werror in V8 build.
  'visibility%': 'hidden',         # V8's visibility setting
  'target_arch%': 'ia32',          # set v8's target architecture
  'host_arch%': 'ia32',            # set v8's host architecture
  'want_separate_host_toolset': 0, # V8 should not build target and host
  'library%': 'static_library',    # allow override to 'shared_library' for D$
  'component%': 'static_library',  # NB. these names match with what V8 expec$
  'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not$
  'gcc_version%': 'unknown',
  'clang%': 0,
  'python%': 'python',
  'arm_version%' : '1',

# Enable V8's post-mortem debugging only on unix flavors.

./configure should work now

make
make install

###All Done

@eoboite
Copy link
Author

eoboite commented Apr 12, 2020

Use the directions on here https://github.com/Entware/Entware-ng/wiki/Install-on-Synology-NAS. Find your platform and it should work from there.

Don’t follow this gist, it’s old. If you’re trying to install nodejs, Synology now provide the updated version in the package store.

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