How to install tmux in Synology NAS Server New Way

I was working on the project where my client wanted to me put all the crawler and application in his own Synology NAS. It was new thing for me. He only new that he was able to run the containers on his server. Rest was my task to figure it out. While working on this project Among alot of problems in each steps I came to this as well which I will share 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:

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

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

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

Step 3: Install tmux

  1. Update Package List:

    opkg update
    
  2. Install tmux:

    opkg install tmux
    

Step 4: Make Installation Persistent

To ensure Entware remains available after system reboots:

  1. Create Startup Script:

    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:

    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:

    tmux
    
  2. Create Named Session:

    tmux new -s mysession
    
  3. List Sessions:

    tmux ls
    
  4. Attach to Session:

    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

Installing tmux on your Synology NAS might seem daunting at first, but using Entware makes the process straightforward and maintainable. This setup will give you a powerful terminal multiplexer that persists across sessions and reboots, making your NAS terminal work much more efficient.

For more advanced users, you can explore custom tmux configurations, scripts, and plugins to further enhance your terminal experience. The investment in setting up tmux properly will pay off in improved productivity and better terminal session management.

Subscribe to My Newsletter

I frequently write about techology.