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
-
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:
sudo mkdir -p /volume1/@entware/opt sudo mount -o bind /volume1/@entware/opt /opt
-
Download and Install Entware:
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
-
Add Entware to PATH:
export PATH=/opt/bin:/opt/sbin:$PATH
Step 3: Install tmux
-
Update Package List:
opkg update
-
Install tmux:
opkg install tmux
Step 4: Make Installation Persistent
To ensure Entware remains available after system reboots:
-
Create Startup Script:
sudo vi /usr/local/etc/rc.d/S99entware.sh
-
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
-
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:
-
Start New Session:
tmux
-
Create Named Session:
tmux new -s mysession
-
List Sessions:
tmux ls
-
Attach to Session:
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/bin
and/opt/sbin
- Try running
hash -r
to 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/@entware
exists - Check if
/opt
is 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
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.