Thursday, October 02, 2014

BootStrap for Synology® DS114 NAS

Recently I have received ability to check out NAS and have been very impressed by “Synology®” products. It is not only NAS storage. It is really small computer with power of NAS. First, I had experience with DS414 model. The second one is DS114 model. They have different microprocessors and power. In this article I try to describe how to add BootStrap on DS114 model. In spite of you pay money for application which you can officially add to this magic box (yes, by this “Synology®” products costs money), you’re able to tweak the system and add additional Linux command line programs to your magic box. The problem is that every model has own ARM processor, so it should be compiled for it. That is why this article is only for DS114 model with ARMADA 370 ARM microprocessor. The process of installation calls bootstrapping. It opens the new really cool possibilities for your magic “Synology®” box.


First of all you need to setup package manager (ipkg) which will allow you to install additional programs from non official repository.
This process you can find easily in the Internet, but I’ll give you information based on my own experience and with my tips.

I won’t describe how to use `ssh’, `vi’ and other stuff, cause you can find it in the Internet. In addition, the people who manage Linux boxes know it very well.

Sure, everything you do is on your own risk.

What you need to have:
1. The box “Synology®” NS114
2. SSH root accès to your box
3. Internet access for your “Synology®” box
4. The experience with UNIX/Linux commands

OK, let’s begin. We will create it manually ;)
(Sorry if long commands drop out of the box)

1. Login by SSH as root

2. Create the optware root directory (enter the following commands): DiskStation> mkdir /volume1/@optware
DiskStation> mkdir /opt
DiskStation> mount -o bind /volume1/@optware /opt

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

4. Add the following line to /etc/profile:
PATH=/opt/bin:/opt/sbin:$PATH

5. Add the following line to /root/.profile:
PATH=/opt/bin:/opt/sbin:$PATH

6. Reboot your DiskStation

7. Login by SSH as root

8. Mount the directory you have created:
DiskStation> mount -o bind /volume1/@optware /opt

9. Create the /etc/rc.local file and insert:
#!/bin/sh
# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start

10. Make this file executable (enter the following commands):
DiskStation> chmod 755 /etc/rc.local

11. Create the /etc/rc.optware file and 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

12. Make this file executable (enter the following commands):
DiskStation> chmod 755 /etc/rc.optware

13. Update ipkg (enter the following commands):
DiskStation> ipkg update

14. Install vim (enter the following commands):
DiskStation> ipkg install vim

That’s it. Easy? ;) vim is in your box.

This command give you a list all programs in repository:
DiskStation> ipkg list

Happy bootstrapping…

No comments: