Your first session on a new Linux VPS: the commands to type, in order

You have just received the VPS address and password and do not know what to type first. The answer is a fixed order, about ten minutes long: see where you are, update, change the password, create a user of your own, add an SSH key, switch the firewall on and set the clock. The commands below are for Ubuntu and Debian, the most used; where AlmaLinux or Rocky Linux differs, it says so. They are your commands on your own server: support does not install or repair them (see how far our support goes).

The order, step by step

1 Sign in as root. In a terminal (on Windows, PowerShell): ssh root@YOUR.VPS.ADDRESS. The first time, the program asks whether you trust the machine: answer yes. The address is in the e-mail you received and in where to find your VPS or dedicated server IP address.
2 See where you are. cat /etc/os-release shows the system and version; free -h the memory; df -h the disk. You learn what you bought and what is left.
3 Update everything. On Ubuntu or Debian: apt update && apt upgrade -y. On AlmaLinux or Rocky: dnf update -y. The image the server is born from is always months behind. If the system asks for a restart, run reboot and sign in again. More in how to update a Debian or Ubuntu VPS.
4 Change the root password. passwd, and type a new, long one. Keep it in a password manager.
5 Create a user of your own with administrator rights and use it day to day. It is in how to create a user with sudo.
6 Add an SSH key and sign in without a password, as that user. It is in how to create an SSH key. Only after testing it do you turn off password sign-in.
7 Switch the firewall on, leaving the SSH port open first. It is in setting up the ufw firewall.
8 Set the time zone and the clock. See how to set the time zone and keep the clock correct.
9 Take a copy before installing anything. On an unmanaged VPS, backups are yours. See backing up a VPS: snapshots or files.
If the system is… Update Firewall Administrator
Ubuntu or Debian apt update, then apt upgrade ufw sudo group
AlmaLinux or Rocky Linux dnf update firewalld wheel group
Do not close the first session until the second one works. With every change that touches SSH, users or the firewall, open a second window and confirm you can get in before closing the first. That is how you avoid being shut out of your own server. If it happens, see I have lost SSH access to my server.
Ask an AI for help, but check. It can explain a command, but copy only what you understand, and never run a command that deletes or changes permissions without knowing what it does. See using AI to write Linux commands without breaking your server.

Did not get the VPS access details, or the address does not answer? Tell us the plan name and the domain.

Open a support ticket

SEE ALSO

First steps with your VPS

Keeping your VPS or dedicated server secure: the six that matter

Which operating system to choose for your VPS or server

Managed or unmanaged VPS: which to choose and who does what

RECOMMENDED PRODUCT

VPS server with root access

Resources of your own, the OS you choose, reinstall whenever you like. from $8.39/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?