How to Use tmux on Linux
tmux keeps shells and jobs alive when SSH drops. Useful for builds, migrations or long-running panels on a VPS.
Steps
Install tmux:
sudo apt updatesudo apt install -y tmuxCreate a named session:
tmux new -s work
tmux keeps shells and jobs alive when SSH drops. Useful for builds, migrations or long-running panels on a VPS.
Install tmux:
sudo apt updatesudo apt install -y tmuxCreate a named session:
tmux new -s workhtop shows live CPU, memory and processes. It is clearer than classic top when a VPS is under load.
Install it on Ubuntu/Debian:
sudo apt updatesudo apt install -y htopOpen it:
htopode.js runs JavaScript on the server (APIs, bots, front builds). On a VPS pick a stable LTS release.
Add the NodeSource LTS repo (22.x example) and install:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt install -y nodejsCheck versions:
Logs grow quietly. logrotate cuts, compresses and drops old files based on a rule.
On Ubuntu it is usually installed. Check the binary:
logrotate --versionCreate a rule for your app (example):
sudo nano /etc/logrotate.d/my-appCertbot requests Let’s Encrypt certificates and wires up HTTPS. You need a domain pointing at the VPS IP and ports 80/443 open.
Install Certbot with your web server plugin (Ubuntu, Nginx example):
sudo apt updatesudo apt install -y certbot python3-certbot-nginxFor Apache, install the matching plugin:
UFW (Uncomplicated Firewall) is the simplest way to filter traffic on Ubuntu. Allow SSH before enabling it or you will lock yourself out.
Install UFW if needed:
sudo apt updatesudo apt install -y ufwAllow SSH (port 22 or your custom port) before enabling:
sudo ufw allow OpenSSHDocker Compose describes several containers in one YAML. Perfect for app + database + proxy with a single command.
Confirm the plugin is available (ships with current Docker Engine):
docker compose versionCreate a project folder and a minimal compose file (sample static web):
iptables filters packets at a low level. Use it when you need fine control or a host without UFW/FirewallD. Order matters: allow first, then deny.
Install the tools (Ubuntu/Debian):
sudo apt updatesudo apt install -y iptables iptables-persistentRestrictive default policy, then allow loopback and established traffic:
A simple tar backup covers files and configs with little effort. Pair it with cron and, if possible, an off-site copy.
Create a backups directory and an executable script.
mkdir -p ~/backupsnano ~/backup.shExample script (adjust paths):
FirewallD is the default dynamic firewall on CentOS/RHEL/Alma. It uses zones and services; permanent rules survive reboot.
Install and start FirewallD:
sudo dnf install -y firewalldsudo systemctl enable --now firewalldCheck the active zone and current allows: