
Short answer: Setting up a new VPS takes about an hour of careful work. Make the decisions that are hard to undo before you order: managed or self-managed, operating system, control panel and data centre. Once the server is running, update it, create a named admin user with sudo, switch SSH to key-only logins, turn on a firewall that allows only the ports you use, add brute-force protection and automatic security updates, and only then install your web stack. After that, point DNS at the server, automate TLS certificates, set up backups you have actually restored from, and add monitoring that alerts a person. Keep a second SSH session or your provider’s browser console open whenever you change SSH or firewall settings, so a typo can’t lock you out.
A new virtual private server is a blank Linux machine on the public internet, and automated scanners will start trying its SSH port within minutes. This guide is for Canadian small businesses and the people who look after their servers, typically after moving up from shared hosting. It goes through the first day in order, explains why each step matters, and gives the commands for Ubuntu, Debian and AlmaLinux/Rocky Linux, with links to the official documentation behind each one. Where it helps, it notes what 4GoodHosting’s VPS plans say they include, so you can see which steps a provider might handle for you.
Some choices can be changed later with little effort, such as adding RAM or CPU. Others mean rebuilding the server from scratch. Settle these four first.
With a self-managed (unmanaged) VPS, you or your developer handle everything inside the operating system: updates, firewall, users, the web server, and fixing things when they break. A managed VPS moves some or all of that to the provider. The line between the two differs from host to host, so check the plan description rather than relying on the label. 4GoodHosting’s data centre page gives the same advice: operating-system maintenance, firewall configuration and resource planning are all part of running a server, and you should confirm which of those tasks the provider handles and which belong to your team.
| Task | Self-managed: usually yours | Managed: often the provider’s (check the plan) |
|---|---|---|
| OS installation and reinstalls | Yours (from a provider template) | Provider |
| Security updates and reboots | Yours | Often provider |
| SSH, users and firewall | Yours | Shared or provider |
| Web server, PHP, database | Yours | Varies; panel-based plans are often covered |
| Application code, plugins, content | Yours | Yours |
| Backups and restore tests | Yours unless you buy a backup add-on | Varies; confirm retention and who restores |
If nobody on your team is comfortable at a Linux command line, a managed plan or a control panel will cost less than an outage. If you have that skill in-house, self-managed gives you full control. 4GoodHosting’s article on whether self-managed VPS hosting is worth it covers the trade-off in more detail.
Size the server to the workload you have now, with some headroom. Upgrading a VPS is usually much easier than moving a site. If you are leaving shared hosting because of resource limits, the signs and the order of options are covered in p4e’s guide to knowing when to upgrade your hosting plan. If page speed is the reason, read how a VPS affects page speed first. More RAM won’t fix a slow theme or uncached database queries.
Pick a long-term-support release that will still be getting security updates well into the server’s expected life. If your control panel or application has requirements, those come first. Here are the support windows published by the projects themselves:
| Distribution and release | Standard or active support | Security support with extended options | Notes |
|---|---|---|---|
| Ubuntu 26.04 LTS | To May 2031 | Extended with Ubuntu Pro (ESM) | Released April 2026; LTS releases come every two years |
| Ubuntu 24.04 LTS | To May 2029 | Extended with Ubuntu Pro (ESM) | Widely documented and supported by tools |
| Debian 13 “trixie” | Regular security support to 2028-08-09 | Debian LTS to 2030-06-30 | Current stable release |
| Debian 12 “bookworm” | Ended 2026-07-11 | Debian LTS to 2028-06-30 | Avoid for new builds |
| AlmaLinux 10 | Active support to May 31, 2030 | Security support to May 31, 2035 | RHEL-compatible; uses dnf and firewalld |
| AlmaLinux 9 | Active support to May 31, 2027 | Security support to May 31, 2032 | RHEL-compatible |
Sources: Ubuntu release cycle, Debian releases, Debian LTS, AlmaLinux release notes. Rocky Linux is also RHEL-compatible; check the Rocky Linux project’s own release pages for its support dates.
Three practical rules:
Decide this before you touch the server. cPanel’s installation guide says to install cPanel & WHM only on a freshly installed operating system. It also says there is no uninstaller: removing it means reformatting the server. If you want a panel, order the VPS with the panel included or install it first, before following the hardening steps below. The panel will manage its own web server, mail, DNS and firewall settings.
| Approach | Good fit when | Trade-offs |
|---|---|---|
| cPanel/WHM (Linux) | You host several sites or client accounts, want email on the server, or are migrating cPanel accounts from shared hosting | Licence cost tied to account count; supported OS list; panel controls much of the stack |
| Plesk (often on Windows) | You need Windows or ASP.NET hosting with a GUI | Licence cost; panel-managed configuration |
| No panel (command line) | One or a few sites, a developer on hand, custom stacks (Node.js, Python, containers) | Every service is yours to configure, update and secure |
Choose the region closest to most of your visitors and your team, and keep in mind where your data will be stored. For most Canadian businesses that means Vancouver for western Canada and Toronto for central and eastern Canada. Also note where backups are stored, since some plans keep them in a different facility from the server.
After you order, the provider sends the server’s IP address and either a root password or an option to add an SSH public key. Some providers also give you a browser-based console. Before you start, find that console or recovery access in your dashboard. It is your way back in if an SSH or firewall change goes wrong.
The safest first login uses an SSH key from the start. If your provider lets you paste a public key at order time, do that. Otherwise, log in once with the temporary password and switch to keys in Step 4.
ssh root@203.0.113.10
(Replace the documentation IP 203.0.113.10 with your server’s address.) The first time you connect, SSH shows the server’s host key fingerprint. If the provider’s dashboard or console shows the fingerprint, compare the two before typing “yes”. Then change the temporary root password immediately with passwd, or remove it once key logins work.
Ubuntu images often skip the root account entirely. Ubuntu’s user management documentation explains that root is disabled by default and the first user is put in the sudo group. Provider images vary, so you may receive either a root login or a named user.
Provider templates are built at a point in time, and security fixes have usually been released since. Install them before you open any services.
Ubuntu and Debian:
sudo apt update
sudo apt full-upgrade
sudo reboot
AlmaLinux and Rocky Linux:
sudo dnf upgrade --refresh
sudo reboot
Reboot if a new kernel was installed, then log back in. Also set the hostname and time zone now (hostnamectl set-hostname and timedatectl set-timezone America/Toronto or America/Vancouver). Log timestamps that match your office make troubleshooting much easier.
Do day-to-day administration as a named user who uses sudo when it needs elevated rights. Avoid working as root. Ubuntu’s documentation notes that sudo records which user ran which administrative command, so you keep accountability even with several admins. Ubuntu 25.10 and later use sudo-rs, a reimplementation of sudo, by default. The commands are the same.
Ubuntu and Debian:
adduser alex
usermod -aG sudo alex
AlmaLinux and Rocky Linux (the admin group is wheel):
useradd -m alex
passwd alex
usermod -aG wheel alex
On a minimal Debian install where a root password was set, sudo may not be installed. Run apt install sudo as root first. Then open a new terminal, log in as the new user, and confirm sudo whoami returns “root” before going further. Create a separate account for each person who needs admin access. Shared logins make it impossible to tell who changed what.
Brute-force password guessing is the most common attack on a new server, and SSH keys remove it as a risk. On your own computer (not the server), generate a key. Ubuntu’s OpenSSH server guide recommends Ed25519 for its shorter keys and lower computational requirements, with RSA as an alternative for older systems.
ssh-keygen -t ed25519 -C "alex@yourcompany.ca"
ssh-copy-id alex@203.0.113.10
Protect the private key with a passphrase when ssh-keygen asks. The ssh-keygen manual explains the options. ssh-copy-id adds your public key to ~/.ssh/authorized_keys on the server. If you copy keys by hand, make sure only your user can write to that file, as Ubuntu’s guide describes (chmod go-w ~/.ssh/authorized_keys). Test that you can log in with the key before you change anything else.
Next, tell the SSH daemon to accept keys only. OpenSSH’s sshd_config manual shows that PasswordAuthentication defaults to yes and PermitRootLogin defaults to prohibit-password, which still allows root to log in with a key. For a small business server with named admin users, turn both off:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo nano /etc/ssh/sshd_config.d/00-hardening.conf
Put these lines in the file:
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
Why a separate file, and why “00”? Ubuntu’s guide explains that the main config includes /etc/ssh/sshd_config.d/*.conf at the very top. Because OpenSSH uses the first value it reads for most directives, settings in that directory override the main file. Some images ship their own file in that directory, for example one created by cloud-init that turns password logins back on. A file that sorts first is read first and wins. To check the settings that will actually apply, run:
sudo sshd -t
sudo sshd -T | grep -Ei "passwordauthentication|permitrootlogin|kbdinteractive"
sshd -t checks the syntax. Never restart SSH if it reports an error. If both commands look right, keep your current session open, restart the service, and test from a second terminal:
sudo systemctl restart ssh # Ubuntu and Debian
sudo systemctl restart sshd # AlmaLinux and Rocky Linux
From the second terminal, check that key login as your admin user works, and that ssh root@... and password logins are refused. Close the first session only after that. Moving SSH to a non-standard port cuts down log noise but adds no real security. If you do it, remember to open the new port in the firewall, and on RHEL-family systems tell SELinux about it, before you restart SSH.
Use a default-deny policy for incoming traffic and allow only what you use: SSH, plus HTTP and HTTPS once a website is running. Allow SSH before you enable the firewall.
Ubuntu and Debian use UFW. Ubuntu’s firewall documentation describes it as Ubuntu’s default firewall configuration tool. Debian may need apt install ufw first.
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose
If your office has a static IP address, you can limit SSH to it. Ubuntu’s documentation shows the form sudo ufw allow proto tcp from 198.51.100.7 to any port 22. Do this only if you have console access as a fallback, because home and mobile IP addresses change.
AlmaLinux and Rocky Linux use firewalld. Its documentation explains the difference between the runtime configuration and the permanent one. Use --permanent so changes survive a reboot, then reload:
sudo systemctl enable --now firewalld
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
On most RHEL-family images, SSH is already allowed in the public zone. Confirm it appears in --list-all before you log out. Never expose database ports (3306, 5432) or admin dashboards to the whole internet. If you need remote database access, use an SSH tunnel or a VPN.
The server firewall is only one layer. Many providers also filter at the network edge for DDoS attacks. That helps against floods but doesn’t replace the server firewall.
Key-only SSH already makes password guessing useless. A tool such as fail2ban still helps: it cuts log noise and protects any other service that does accept passwords, such as mail or a panel login. Its project page explains that it scans log files such as /var/log/auth.log and bans IP addresses with too many failed login attempts, by updating firewall rules to reject them for a set time.
sudo apt install fail2ban # Ubuntu and Debian
sudo dnf install epel-release && sudo dnf install fail2ban # AlmaLinux and Rocky Linux
Never edit jail.conf directly. Create /etc/fail2ban/jail.local and enable the SSH jail:
[sshd]
enabled = true
maxretry = 5
bantime = 1h
If your distribution logs to the systemd journal instead of /var/log/auth.log, add backend = systemd to the jail. Then run sudo systemctl enable --now fail2ban and check it with sudo fail2ban-client status sshd. Be careful with very long ban times if staff connect through shared office or mobile networks. A ban hits everyone behind that IP address.
Unpatched software is the easiest way into a server. The Canadian Centre for Cyber Security puts “Automatically patch operating systems and applications” second in its baseline controls for small and medium organizations, and recommends automatic patching wherever possible.
Ubuntu: Ubuntu’s automatic updates guide says security updates are applied automatically through the unattended-upgrades package, which is installed by default. Two details matter. Packages from repositories you add yourself are not included unless you configure them. And automatic reboots are optional, so a kernel update may sit until someone reboots. Choose a reboot time when traffic is low, or schedule reboots yourself.
Debian: install and enable the same tool:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
AlmaLinux and Rocky Linux: use dnf-automatic. Its documentation shows that apply_updates defaults to False, which means updates are downloaded but not installed until you change the setting. In /etc/dnf/automatic.conf, set apply_updates = yes (and upgrade_type = security if you want security fixes only), then enable the timer:
sudo dnf install dnf-automatic
sudo systemctl enable --now dnf-automatic.timer
Automatic OS updates do not cover WordPress, plugins, Composer or npm packages. Those need their own schedule. 4GoodHosting’s piece on website patch management covers that application layer.
If you chose cPanel or another panel, install it now, on the freshly built server. The panel handles the web server, PHP versions, databases, mail and often its own firewall integration. From then on, make changes through the panel. Editing files the panel manages by hand can be overwritten on the next update.
Without a panel, install only what the site needs:
| Stack | Components | Typical use |
|---|---|---|
| LAMP | Linux, Apache, MariaDB or MySQL, PHP | WordPress and most PHP apps; .htaccess compatibility |
| LEMP | Linux, Nginx, MariaDB or MySQL, PHP-FPM | PHP sites where Nginx’s lower memory use under load helps |
| Reverse proxy plus app | Nginx or Caddy in front of Node.js, Python or containers | Custom applications |
Habits that prevent most problems:
mysql_secure_installation or the MariaDB equivalent.ss -tulpn lists what is listening).If the site is moving from another host, build and test it on the VPS first. You can preview it by temporarily adding the domain to your computer’s hosts file. Then:
Let’s Encrypt issues free domain-validated certificates, and Certbot is the most common client on a VPS without a panel. Select your web server and OS on Certbot’s instructions page for the exact install method. The usual flow is sudo certbot --nginx or sudo certbot --apache, followed by sudo certbot renew --dry-run to test renewal. Panels such as cPanel usually handle certificates automatically.
Two details catch people out:
Set up backups before the site goes live, not after the first incident. A provider snapshot copies the whole disk at a moment in time, which is very useful before upgrades and risky changes. It is not a full backup strategy on its own if it is stored on the same platform and kept for only a few days. A sound plan has at least one copy away from the server, versioned history, database dumps that are consistent, and a restore you have actually tested.
Cover these on a VPS:
/etc (your configuration).mysqldump or mariadb-dump, pg_dump), not only raw copies of data files.For a full plan with schedules, tools and restore testing, see p4e’s website backup strategy guide.
Monitoring is only useful if an alert reaches someone who will act on it. At a minimum, cover:
| Check | Why it matters | Simple approach |
|---|---|---|
| External uptime (HTTP and HTTPS) | Finds outages before customers do | A third-party uptime monitor checking every 1 to 5 minutes |
| Disk space | A full disk stops databases, mail and logging | Alert at 80 percent and 90 percent |
| CPU, RAM and swap | Shows when you need to upgrade or something is misbehaving | Provider graphs plus alerts, or an agent |
| Certificate expiry | Shorter lifetimes leave less time to catch a failed renewal | Uptime tools with TLS checks |
| Backup job success | Silent backup failures are common | Alert when a job fails or doesn’t run |
| Auth and fail2ban logs | Spot attacks and unexpected logins | Weekly review, or forward logs to a central service |
4GoodHosting’s article the case for website monitoring explains why external checks belong alongside the server’s own graphs.
The steps above cover the most common attacks. For a formal baseline, two free references are worth knowing:
In practice, that means turning on two-factor authentication for your hosting account, control panel and DNS registrar. Those logins can rebuild or redirect your server no matter how well SSH is locked down. 4GoodHosting’s article on data security best practices for VPS servers covers more of the same ground.
| Order | Step | Done when |
|---|---|---|
| 1 | Find console or recovery access | You can open it from the dashboard |
| 2 | Update the OS and reboot | No pending updates; correct hostname and time zone |
| 3 | Create a named sudo user | sudo whoami returns root |
| 4 | Set up SSH keys; turn off password and root logins | sshd -T shows the settings; root and password logins refused |
| 5 | Firewall default-deny; allow 22, 80, 443 | ufw status or firewall-cmd --list-all matches |
| 6 | fail2ban for SSH | fail2ban-client status sshd shows the jail |
| 7 | Automatic security updates | unattended-upgrades or dnf-automatic timer active |
| 8 | Panel or web stack | Only needed services listening (ss -tulpn) |
| 9 | DNS with low TTL; cut over | Site resolves to the VPS |
| 10 | TLS with automated renewal | certbot renew --dry-run succeeds |
| 11 | Backups off-server; test restore | A restore has been done and timed |
| 12 | Monitoring and alerts | A test alert reached a person |
4GoodHosting is a Canadian host, and its VPS pages describe several options that relate to the steps above. These details come from the company’s live product pages. Confirm current specifics with them before ordering, because product pages change.
Even with a managed plan, ask the provider which of the twelve steps they do and which stay with you. Application updates, user accounts for your staff, and restore testing usually stay with you.
Hardening a fresh server (updates, user, SSH keys, firewall, fail2ban, automatic updates) takes about an hour for someone who has done it before. Installing the web stack, moving a site and cutting over DNS can take anything from an afternoon to a few days, depending on site size and DNS TTLs.
Both are solid choices. Ubuntu LTS has the most tutorials and community answers, and ships unattended-upgrades by default. AlmaLinux suits teams used to Red Hat tools and has long security support. If you want cPanel, both appear on cPanel’s supported list. Pick the one your administrator knows best.
Yes. Network-level DDoS filtering absorbs floods of traffic. A server firewall controls which services anyone can reach at all. You want both.
For a server run by named admins with sudo, yes: set PermitRootLogin no. OpenSSH’s default, prohibit-password, already blocks root password logins but still allows root keys. Turning it off completely means every admin action can be traced to a named account.
cPanel’s installation guide says to install only on a freshly installed operating system, and it has no uninstaller. Plan for a new server, then migrate the sites onto it.
Not by itself. Snapshots are great for quick rollbacks, but you also need off-server copies with longer history, consistent database dumps and tested restores.
Certbot and control panels renew automatically once set up. Your job is to check that renewal actually works (certbot renew --dry-run) and to monitor expiry, especially as Let’s Encrypt moves to 64-day and then 45-day certificates.
sshd -t and sshd -T while a second session stays open.apply_updates = yes, plus a separate schedule for application updates.About the author: This article was written by the team at 4GoodHosting, a Canadian web hosting company operating since 2002 with servers in Vancouver and Toronto. This article is a guest contribution to P4 Emachines.





