New VPS Setup Commands, Step by Step

Secure a new server from minute one: a sudo user, SSH key login, firewall, Fail2ban, swap and automatic updates, plus Docker and Nginx if you want. Pick options and copy a ready Bash script.

Create the script now
root@vps$ apt-get -y upgrade$ adduser deploy$ ufw allow 2222/tcp$ systemctl enable fail2ban$ swapon /swapfile✓ doneFirewallSSH key

Generator

Your script

How the tool works

Simple steps, all in your browser with no sign-up.

Pick the OS

Ubuntu or AlmaLinux.

Pick protections

User, key, firewall, Fail2ban.

Run the script

As root.

What each option does

OptionWhy
sudo userYou work as it daily instead of root, avoiding full-power mistakes
SSH key, no passwordsStops password-guessing attacks entirely
Change SSH portCuts automated login noise in logs, but is not protection on its own
FirewallCloses every port except those you need
Fail2banBans addresses that keep failing to log in
SwapDisk-backed memory that keeps services alive when RAM fills
Automatic updatesSecurity patches install without waiting for you

Before you run the script

  1. Connect to the server as root.
  2. Create an SSH key on your computer if you have none, and copy only the public part.
  3. Run the script, and keep this session open.
  4. Open a new window and log in with the new user and port. If it works, close the old session.
  5. Then run your projects, for example with the Docker Compose generator.

Useful commands after setup

CommandWhat it shows
ufw status verboseOpen ports (Ubuntu)
firewall-cmd --list-allOpen ports (AlmaLinux)
fail2ban-client status sshdBanned addresses
free -hMemory and swap
df -hDisk usage
journalctl -u ssh -n 50Latest login logs

Key terms

Short definitions of what you meet along the way.

SSH
An encrypted connection to manage a server from the terminal.
SSH key
A key pair: the private one stays on your computer, the public one goes on the server. Stronger than a password.
sudo
Running a command with admin rights from a normal user, with logging.
Fail2ban
Software that reads logs and bans addresses with repeated failed logins.
Swap
Disk space the system uses as extra memory when RAM fills.

Frequently asked questions

Did not find your answer? Ask us on WhatsApp

Does it work on any server?

On recent Ubuntu, Debian, AlmaLinux and Rocky Linux. Try it on a fresh server before one with live sites.

What if I lock myself out?

That is why you keep the session open while testing. If it happens, use the console in your provider's panel.

Do I need this with cPanel?

No. cPanel has its own settings and firewall; this script is for bare servers.

Is my key stored by you?

No. The script is built in your browser.

How much RAM do I need?

It depends on your projects. Try the VPS calculator on the servers page.

Want a server ready without setup?

VPS servers, and we can prepare them for you on request.

Contact us on WhatsApp