Got your first Linux VPS and not sure what to do next? This guide walks you through the essential first steps: connecting, securing it, and getting it ready to host something. No prior Linux experience required.
Step 1: Connect via SSH
Your provider gives you an IP address, a username (often root), and a password or SSH key.
On Windows, macOS, or Linux terminal:
ssh root@your.server.ip
Enter your password (or use your SSH key). You are now in your server's command line.
Step 2: Update the System
Always update first. On Debian/Ubuntu:
apt update && apt upgrade -y
On CentOS/Rocky/Alma:
dnf update -y
This patches security holes and gets you current packages.
Step 3: Create a Non-Root User
Running as root all the time is risky. Create a regular user with sudo:
adduser myname
usermod -aG sudo myname # Debian/Ubuntu
Then log in as that user for daily work and use sudo when needed.
Step 4: Secure SSH
Lock down remote access:
- Use SSH keys instead of passwords (much safer)
- Disable root login in
/etc/ssh/sshd_config(PermitRootLogin no) - Consider changing the SSH port to cut down on bot noise
- Restart SSH after changes:
systemctl restart sshd
Step 5: Set Up a Firewall
On Ubuntu, UFW is simple:
ufw allow OpenSSH
ufw enable
Then open only the ports you need (e.g. 80/443 for a web server). Deny everything else by default.
Step 6: Install What You Need
Now host something. Common first installs:
- Web server:
apt install nginx - Database:
apt install mariadb-server - Node.js / Python / PHP for apps
- Docker for containerized apps
- A game server or bot
Step 7: Keep It Maintained
- Update regularly (
apt update && apt upgrade) - Set up backups of important data
- Monitor resources with
htopanddf -h - Use fail2ban to block brute-force attempts
Essential Commands to Know
| Command | Use |
|---|---|
ls, cd, pwd | Navigate files |
nano / vim | Edit files |
htop | View CPU/RAM usage |
df -h | Check disk space |
systemctl | Manage services |
journalctl | View logs |
Tips
- Never run untrusted scripts as root
- Use SSH keys from day one
- Take a snapshot/backup before big changes
- Start small and learn one service at a time
FAQ
How do I connect to a Linux VPS?
Use SSH: ssh root@your.server.ip from a terminal.
What should I do first on a new VPS? Update the system, create a non-root user, secure SSH, and set up a firewall.
Do I need to know Linux to use a VPS? Basic commands help, but you can learn as you go. Start with the steps above.
Related: Cheap VPS hosting guide, Free VPS hosting truth, What is VPS hosting