Archived server bootstrap script for Debian and Ubuntu VPS instances. This repository is kept as a practical shell-script reference, not as a live hosting recommendation page.
linux-server-init is a small set of scripts for preparing a new Linux VPS: package updates, basic tools, UFW firewall, SSH hardening, fail2ban, optional swap and optional TCP BBR.
For current maintained VPS tools and notes, start here:
| Need | Maintained Resource |
|---|---|
| General VPS tools and server resources | awesome-vps-tools |
| BandwagonHost / 搬瓦工 speed test and datacenter notes | bwg-speed-test |
| 中文搬瓦工套餐、库存和购买前判断 | BWH Guide |
- Updates Debian/Ubuntu packages.
- Installs common CLI tools such as
htop,vim,curl,git,wget,tmuxandncdu. - Sets the server timezone.
- Enables UFW and opens SSH, HTTP and HTTPS.
- Applies basic SSH hardening.
- Installs and configures fail2ban for SSH.
- Adds swap automatically for low-memory servers.
- Enables TCP BBR when supported by the kernel.
Shell bootstrap scripts can lock you out of a server if they change SSH, firewall or network settings incorrectly. Before running this script on a real VPS:
- Open a second SSH session and keep it connected.
- Confirm your SSH port, firewall rules and provider console access.
- Review
init.shbefore running it. - Make sure you have a working SSH key before disabling password login manually.
- Test on a fresh disposable server before using it on production.
Avoid running remote scripts blindly with curl | bash unless you have reviewed the script and trust the source.
Recommended: clone or download the repository first, then run the script locally:
git clone https://github.com/devguoo/linux-server-init.git
cd linux-server-init
bash init.sh --timezone Asia/Shanghai --ssh-port 22Historical one-line usage:
curl -sL https://raw.githubusercontent.com/devguoo/linux-server-init/main/init.sh | bashFor custom options:
bash init.sh --timezone Asia/Shanghai --ssh-port 22222
bash init.sh --no-swap
bash init.sh --no-bbr| Option | Default | Description |
|---|---|---|
--timezone |
Asia/Shanghai |
Server timezone. |
--ssh-port |
22 |
SSH port to allow and configure. |
--no-swap |
disabled | Skip swap creation. |
--no-bbr |
disabled | Skip BBR setup. |
# Create a 2GB swap file
bash scripts/setup-swap.sh 2
# Enable TCP BBR
bash scripts/setup-bbr.shconfigs/sshd_config- SSH hardening example.configs/jail.local- fail2ban SSH jail example.
Apply samples manually only after checking whether they fit your server:
cp configs/sshd_config /etc/ssh/sshd_config
cp configs/jail.local /etc/fail2ban/jail.local
systemctl restart sshd fail2banThe scripts were written for:
- Debian 11 / 12
- Ubuntu 20.04 / 22.04 / 24.04
- Root shell access
They may need adjustments for newer distributions or providers with custom images.
This repository is archived in practice:
- No live VPS pricing or provider ranking is maintained here.
- No direct affiliate or referral links are included here.
- New VPS tooling and resource updates should go to awesome-vps-tools.
MIT