Getting started on a Linux Ubuntu VPS
Have you just hired a Linux VPS and don't know where to start? This guide brings together the most important initial configurations to make an Ubuntu server up to date, organized and more secure.
The commands are recommended for Ubuntu Server 22.04 or 24.04. Run them as root or add sudo when necessary.
1. Access the VPS via SSH
ssh root@IP_DA_VPS
Replace IP_DA_VPS with the address you received. On the first connection, confirm the key by typing yes.
See also how to connect to a Linux VPS via SSH on Windows.
2. Update Ubuntu
apt update
apt upgrade -y
apt autoremove -y
Updates fix security holes and install recent versions of available packages.
3. Configure the time zone
Check the time:
timedatectl
To use Brasilia time:
timedatectl set-timezone America/Sao_Paulo
A correct time makes it easier to analyze logs and scheduled tasks.
4. Set the hostname
Choose a short name without spaces:
hostnamectl set-hostname minha-vps
hostnamectl
The hostname helps identify the server in the terminal and in monitoring tools.
5. Create an administrative user
adduser administrador
usermod -aG sudo administrador
Test before ending the current session:
su - administrador
sudo whoami
The expected result is root. See the complete tutorial on how to create a sudo user on Ubuntu VPS.
6. Enable firewall without blocking SSH
First, enable SSH:
ufw allow OpenSSH
Then, activate and check the firewall:
ufw enable
ufw status verbose
Only open ports used by applications. Learn more at how to use UFW on Linux VPS.
7. Check features
free -h
df -h
uptime
If your VPS is slow, see what to check on a slow Linux VPS.
8. Restart the VPS
reboot
The SSH connection will be closed. Wait a few seconds and connect again.
Frequently asked questions
Do I need to update a new VPS?
Yes. The system image may have been created before the most recent updates.
Can I host websites and games on the same VPS?
It's possible, but all services share CPU, memory, disk and network. Monitor consumption.
Can the UFW block my access?
Yes. Always allow OpenSSH before enabling the firewall and test a second connection before closing the current session.
If you need help, open a ticket with Nice Hosting support.