I don't want to use VIM to edit files on my Synology NAS. I have no clue why the good people of Synology forgot to put the nano editor on the machine. There is no package manager nor a C compiler present on the system... so let's fix that by installing the Entware package manager.
These scripts only work on DSM 6+. I'm assuming that you already have a working SSH terminal to your NAS. If you break stuff, you are on your own. A lot of the scripts will run as root.
When you only need Nano (and don't want to install Entware), you could install it as a SynoCommunity package.
- Open Package Center.
- Open Settings.
- Go to Package Sources.
- Click Add button.
- Name: SynoCommunity, location: http://packages.synocommunity.com/
- Click OK button
- Type nano into the search bar and install the SynoCli File Tools. It contains the following tools: less, tree, ncdu, jdupes, fdupes, rhash, mc (midnight commander), nano, file, detox, pcre2, zstd, lzip, plzip, rmlint, rnm, micro (editor), fzf (fuzzy finder).
It is easier than installing all the scripts.
Entware needs to land somewhere, this will create the right directory:
# create a home for Entware mkdir -p /volume1/@Entware/opt # go on as root sudo -i # remove a previous install rm -rf /opt # link the folders ln -sf /volume1/@Entware/opt /opt echo "Done!"
Run the following script to discover your processor and architecture:
\ printf "\nProcessor: "; \ cat /proc/cpuinfo | \ grep "model name" | \ grep "[^:]*$" -o | \ uniq; \ printf "Architecture: "; \ uname -m; \ printf "\n"
I'm using a DS218+, so the script shows that the processor is an Intel(R) Celeron(R) CPU J3355 @ 2.00GHz and the architecture is x86_64 - something I would expect with this processor. (My Raspberry Pi 3 returns ARMv7 Processor rev 4 (v7l) / armv7l)
Now that you have the architecture figured out, you know what script you'll need to run. These script need to run as root.
wget -O - http://bin.entware.net/armv5sf-k3.2/installer/generic.sh | /bin/sh
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
If you install the wrong link, don't worry. Just run the previous step and the right script.
Let's write the startup file using a script. This startup file is only for DS6+ installations.
# leave root exit; # remove previous file rm entware-startup.sh 2> /dev/null # write the startup file printf "#!" >> entware-startup.sh echo "/bin/sh" >> entware-startup.sh echo "" >> entware-startup.sh echo "case $1 in" >> entware-startup.sh echo " start)" >> entware-startup.sh echo " mkdir -p /opt" >> entware-startup.sh echo " mount -o bind /volume1/@Entware/opt /opt" >> entware-startup.sh echo " /opt/etc/init.d/rc.unslung start" >> entware-startup.sh echo " ;;" >> entware-startup.sh echo " stop)" >> entware-startup.sh echo " ;;" >> entware-startup.sh echo "esac" >> entware-startup.sh # copy the startup file sudo mv entware-startup.sh /usr/local/etc/rc.d/entware-startup.sh echo "Done!"
Before we are done, we need to add some stuff to the profile. This makes sure the package manager is part of your PATH when you use the terminal. We will also reboot the machine.
sudo -i echo "" >> /etc/profile; echo ". /opt/etc/profile" >> /etc/profile reboot
Now we can install all the packages we want. Let's install nano:
sudo opkg install nano
2021-03-27 Updated the name of the package, as nano is now part of the SynoCli File Tools package.