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
-
Enable SSH Access:
- Open DiskStation Manager (DSM)
- Navigate to Control Panel → Terminal & SNMP
- Check “Enable SSH service”
- Click Apply
-
Connect via SSH:
- Use your preferred SSH client to connect to your NAS
- Login with your admin credentials
Step 2: Install Entware
-
Create Required Directories:
Terminal window sudo mkdir -p /volume1/@entware/optsudo mount -o bind /volume1/@entware/opt /opt -
Download and Install Entware:
Terminal window wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh -
Add Entware to PATH:
Terminal window export PATH=/opt/bin:/opt/sbin:$PATH
Step 3: Install tmux
-
Update Package List:
Terminal window opkg update -
Install tmux:
Terminal window opkg install tmux
Step 4: Make Installation Persistent
To ensure Entware remains available after system reboots:
-
Create Startup Script:
Terminal window sudo vi /usr/local/etc/rc.d/S99entware.sh -
Add Following Content:
#!/bin/shcase $1 instart)mkdir -p /volume1/@entware/optmount -o bind /volume1/@entware/opt /opt;;stop)umount /opt;;*)echo "Usage: $0 [start|stop]"exit 1;;esac -
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:
-
Start New Session:
Terminal window tmux -
Create Named Session:
Terminal window tmux new -s mysession -
List Sessions:
Terminal window tmux ls -
Attach to Session:
Terminal window tmux attach -t mysession
Common tmux Shortcuts
All commands are prefixed with Ctrl+b:
d: Detach from current sessionc: Create new windown: Next windowp: Previous window%: Split pane horizontally": Split pane vertically- Arrow keys: Navigate between panes
Troubleshooting Common Issues
-
Command Not Found
- Verify Entware installation
- Check if PATH includes
/opt/binand/opt/sbin - Try running
hash -rto clear command cache
-
Permission Denied
- Ensure you’re using sudo for administrative tasks
- Check file permissions on startup scripts
- Verify your user has sufficient privileges
-
Mount Point Errors
- Confirm
/volume1/@entwareexists - Check if
/optis already mounted - Try unmounting and remounting if necessary
- Confirm
Why This Method?
While some guides suggest using older methods like ipkg or the SynoCommunity package source, the Entware approach offers several advantages:
- Modern Package Management: Entware is actively maintained and updated
- Better Compatibility: Works across different Synology models
- Larger Package Repository: Access to more software packages
- 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.