Skip to content

Instantly share code, notes, and snippets.

@marlun78
Created March 4, 2014 16:26
Show Gist options
  • Save marlun78/9349792 to your computer and use it in GitHub Desktop.
Save marlun78/9349792 to your computer and use it in GitHub Desktop.
# How to install `ipkg` on a Synology DS214
After a couple of days of trying to get `ipkg` woking on my DS214 I found [this article](https://github.com/trepmag/ds213j-optware-bootstrap) by [trepmag](https://github.com/trepmag). It is written for the DS213j, but it’s been working for me and [others](https://github.com/alberthild) for the DS214 too.
I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.
## Guide
### SSH
You need to have enabled `ssh` on your DiskStation. Then open up your terminal and type:
```bash
$ ssh root@[your-ds-ip]
```
Read more about how to setup SSH on your DiskStation [here](http://forum.synology.com/wiki/index.php/Enabling_the_Command_Line_Interface).
### Create optware root directory
```bash
$ mkdir /volume1/@optware
$ mkdir /opt
$ mount -o bind /volume1/@optware /opt
```
### Setup ipkg
```bash
$ 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
```
(Source: http://www.nslu2-linux.org/wiki/Optware/HomePage)
### Set PATH
Open `/etc/profile`:
```bash
$ vi /etc/profile
```
Type `i` to enable insertion mode. See more `vi`-commands [here](http://forum.synology.com/wiki/index.php/Basic_commands_for_the_Linux_vi_Editor).
Add `/opt/bin:/opt/sbin:` to the `PATH` variable.
Then press `ESC` and press `ZZ` to save and exit.
If you are signed in as `root` as I was, you need to do the same to the `/root/.profile` file - then:
```bash
$ source /root/.profile
```
### Create init scripts
The following steps will allow to automatically bind the /volume1/@optware directory to /opt and trigger the /opt/etc/init.d/* scripts.
Create the /etc/rc.local (chmod 755):
```bash
$ touch /etc/rc.local
$ chmod 755 /etc/rc.local
$ vi /etc/rc.local
```
Insert:
```bash
#!/bin/sh
# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start
```
Then press `ESC` and press `ZZ` to save and exit.
Create the `/etc/rc.optware` file (chmod 755):
```bash
$ touch /etc/rc.optware
$ chmod 755 /etc/rc.optware
$ vi /etc/rc.optware
```
Insert:
```bash
#! /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
```
(source: a working optware env)
I had trubbles copy/paste this code from Github and insert it into `rc.optware` with the `vi` editor and I had to go line by line to get it in correctly.
### Finaly
Reboot the DiskStation and you should be done!
As I said, I’m not a Linux guy, so if you spot a misstake, please let me know.
I hope this helps!
Good luck!
@tolidano
Copy link

I have a DS216j and used this before coming here: https://zarino.co.uk/post/ds214se-under-the-hood/

@FlorianCassayre
Copy link

Awesome, the detailed steps helped me install it on my station. Thank you so much!

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