How to install tmux in Synology NAS Server New Way

Surendra Tamang

Surendra Tamang

18 min read
Synology Server

I was working on a project where my client wanted me to put all the crawlers and applications on his own Synology NAS. It was a new thing for me. He only knew that he was able to run containers on his server. The rest was my task to figure out. Among a lot of problems at each step of this project, I ran into this one too, so I am sharing it here.

Installing tmux on NAS can be frustrating.

To install tmux on a Synology NAS, you typically need to use package managers because Synology’s DiskStation Manager (DSM) doesn’t include tmux by default. While many guides suggest using ipkg, the modern approach is to use Entware with opkg.

Here’s a step-by-step guide on how to install tmux on your Synology NAS:

Step 1: Prepare Your System

  1. Enable SSH Access:

    • Open DiskStation Manager (DSM)
    • Navigate to Control Panel → Terminal & SNMP
    • Check “Enable SSH service”
    • Click Apply
  2. Connect via SSH:

    • Use your preferred SSH client to connect to your NAS
    • Login with your admin credentials

Step 2: Install Entware

  1. Create Required Directories:

    Terminal window
    sudo mkdir -p /volume1/@entware/opt
    sudo mount -o bind /volume1/@entware/opt /opt
  2. Download and Install Entware:

    Terminal window
    wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
  3. Add Entware to PATH:

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

Step 3: Install tmux

  1. Update Package List:

    Terminal window
    opkg update
  2. Install tmux:

    Terminal window
    opkg install tmux

Step 4: Make Installation Persistent

To ensure Entware remains available after system reboots:

  1. Create Startup Script:

    Terminal window
    sudo vi /usr/local/etc/rc.d/S99entware.sh
  2. Add Following Content:

    #!/bin/sh
    case $1 in
    start)
    mkdir -p /volume1/@entware/opt
    mount -o bind /volume1/@entware/opt /opt
    ;;
    stop)
    umount /opt
    ;;
    *)
    echo "Usage: $0 [start|stop]"
    exit 1
    ;;
    esac
  3. Make Script Executable:

    Terminal window
    sudo chmod +x /usr/local/etc/rc.d/S99entware.sh

Basic tmux Usage

Once installed, you can start using tmux with these basic commands:

  1. Start New Session:

    Terminal window
    tmux
  2. Create Named Session:

    Terminal window
    tmux new -s mysession
  3. List Sessions:

    Terminal window
    tmux ls
  4. Attach to Session:

    Terminal window
    tmux attach -t mysession

Common tmux Shortcuts

All commands are prefixed with Ctrl+b:

  • d: Detach from current session
  • c: Create new window
  • n: Next window
  • p: Previous window
  • %: Split pane horizontally
  • ": Split pane vertically
  • Arrow keys: Navigate between panes

Troubleshooting Common Issues

  1. Command Not Found

    • Verify Entware installation
    • Check if PATH includes /opt/bin and /opt/sbin
    • Try running hash -r to clear command cache
  2. Permission Denied

    • Ensure you’re using sudo for administrative tasks
    • Check file permissions on startup scripts
    • Verify your user has sufficient privileges
  3. Mount Point Errors

    • Confirm /volume1/@entware exists
    • Check if /opt is already mounted
    • Try unmounting and remounting if necessary

Why This Method?

While some guides suggest using older methods like ipkg or the SynoCommunity package source, the Entware approach offers several advantages:

  1. Modern Package Management: Entware is actively maintained and updated
  2. Better Compatibility: Works across different Synology models
  3. Larger Package Repository: Access to more software packages
  4. Easier Maintenance: Simpler updates and package management

Conclusion

With the startup script in place, Entware and tmux survive DSM reboots, which was the part missing from my first write-up. From here, tmux configs and plugins work the same as on any other Linux box.

Surendra Tamang

About Surendra Tamang

Software Engineer specializing in web scraping, data engineering, and full-stack development. Passionate about transforming complex data challenges into elegant solutions.

Continue reading