Install nano with Entware on Synology NAS (DSM6+)

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.

Nano as a package

When you only need Nano (and don't want to install Entware), you could install it as a SynoCommunity package.

  1. Open Package Center.
  2. Open Settings.
  3. Go to Package Sources.
  4. Click Add button.
  5. Name: SynoCommunity, location: http://packages.synocommunity.com/
  6. Click OK button
  7. 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.

Nano is available in the Package Center as SynoCommunity Package. It is now part of the SynoCli File Tools.

Preparation

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!"

Determine architecture

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)

Install Entware by script

Now that you have the architecture figured out, you know what script you'll need to run. These script need to run as root.

  • armv5: wget -O - http://bin.entware.net/armv5sf-k3.2/installer/generic.sh | /bin/sh
  • armv7: wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
  • armv8: wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
  • x64: 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.

Start Entware at startup

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!"

Add to profile and reboot

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

And finally... it's installation time!

Now we can install all the packages we want. Let's install nano:

sudo opkg install nano

Easy peasy!

Improvements

2021-03-27 Updated the name of the package, as nano is now part of the SynoCli File Tools package.

  1. crouchpotato says:

    Very very helpful, thanks Kees! Finally free of the VI shackles ;)

  2. Arkadiusz Sworobowicz says:

    Thanks a lot for hints :)

  3. toudidel says:

    works like a charm. thanks a lot

  4. Cristian Rodríguez Gutiérrez says:

    Muchas gracias, me ha funcionado.
    Saludos.

expand_less