If you’re used to shared hosting, switching to a Virtual Private Server (VPS) can feel like quite a leap. It’s not as plug-and-play as cPanel hosting, but it unlocks far more flexibility and control – especially for developers, small business owners, or anyone hosting apps and websites that need room to grow.
Think of shared hosting like renting a flat in a managed building. With a VPS, you're building your own home on a plot of land. You get full control, but you’re also responsible for the plumbing, security and maintenance.
With the right guidance, setting up your own VPS is absolutely doable, even if you're not a seasoned sysadmin.
If you haven’t yet picked your VPS hosting plan, you can explore our UK-based VPS hosting options before diving in.
What you’ll need before you start
This guide is focused on unmanaged VPS hosting with Ubuntu 22.04 or AlmaLinux 9, the two most common OS choices on our platform. It assumes you're starting from a fresh install.
You’ll need:
A VPS hosting plan from a reliable provider (Krystal VPS plans come with SSD/NVMe storage, DDoS protection, UK-based support and more)
A basic familiarity with using the command line
An SSH client:
- Mac/Linux users can use the built-in Terminal
- Windows users should download and install PuTTY
Your server’s IP address, root username and password (these are provided in your welcome email)
Step 1: choose and purchase your VPS
When choosing your VPS, look for:
- Enough CPU and RAM for your intended workload
- NVMe storage (it’s faster)
- Comprehensive security
- A location close to your users (for UK-based sites, choose a hosting provider with a UK data centre)
- Option to scale resources later
- Solid sustainability credentials
Krystal’s VPS plans also include:
- Unlimited bandwidth
- Full root access
- 2,000Gbps DDoS protection
- Free setup and monthly snapshot backups
- 60-day money-back guarantee
- UK-based support, including live chat
- VPS hosting powered by 100% renewable energy
- A tree planted each month on your behalf
Once you’ve signed up, you’ll receive your server’s IP address, root login and password.
Step 2: connect to your VPS
Mac/Linux users:
- Open Terminal (you’ll find it in your Applications or search for it).
- Type the following command, replacing
your-server-ip
with your VPS IP address:ssh root@your-server-ip
- Press Enter. If it's your first time connecting, type
yes
to confirm. - When prompted, enter the root password from your welcome email.
Windows users:
- Open PuTTY.
- In the Host Name field, enter your VPS IP address.
- Set Port to
22
. - Click Open. A terminal window will appear.
- Enter
root
as the username when prompted. - Enter the password from your welcome email (note: nothing will appear as you type — that’s normal).
Once logged in, you’re ready to configure your server.
Step 3: update your server and create a new user
Before anything else, it's important to update your system and create a non-root user for day-to-day tasks.
Ubuntu/Debian
Open your terminal or PuTTY session and run:
apt update && apt upgrade -y
adduser yourusername
usermod -aG sudo yourusername
AlmaLinux/CentOS
dnf update -y
adduser yourusername
usermod -aG wheel yourusername
The wheel
group on Alma/CentOS provides sudo privileges by default.
Disable root login
Still connected via SSH, edit the SSH config file:
nano /etc/ssh/sshd_config
Look for the line PermitRootLogin
and change it to:
PermitRootLogin no
Save and exit the file (in nano, press CTRL + X
, then Y
, then Enter
), then restart SSH:
systemctl restart sshd
From now on, use your new user for logging in.
Step 4: set up your firewall and install fail2ban
Now that you're connected to your VPS, it's time to secure it. First, you’ll set up a basic firewall to only allow essential types of traffic (like web and SSH access). Then, you'll install Fail2Ban, a tool that helps protect your server from repeated brute-force login attempts.
All of the commands below should be entered into the same terminal or SSH window you opened in Step 2.
A. Set up your firewall
For Ubuntu/Debian users:
Ubuntu uses a firewall tool called UFW (Uncomplicated Firewall), which makes managing firewall rules easier.
- Allow SSH so you don’t get locked out:
ufw allow OpenSSH
- Allow standard web traffic:
ufw allow 80
ufw allow 443
Port 80 is used for regular (non-secure) web traffic.
Port 443 is for secure HTTPS traffic.
- Enable the firewall:
ufw enable
You’ll be prompted to confirm. Type y
and press Enter.
For AlmaLinux/CentOS users:
These systems use firewalld, a firewall management tool. Here’s how to allow SSH and web traffic:
- Add services to the firewall:
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
- Reload the firewall to apply the changes:
firewall-cmd --reload
Tip: These commands open up access to your server for management (SSH) and for your website (HTTP/HTTPS). If you're planning to host other types of services (like FTP or email), you'll need to open those ports too.
B. Install Fail2Ban
Fail2Ban helps protect your VPS from repeated login attempts by monitoring logs and banning suspicious IPs.
For Ubuntu/Debian:
apt install fail2ban -y
For AlmaLinux/CentOS:
First, install the EPEL (Extra Packages for Enterprise Linux) repository, which contains Fail2Ban:
dnf install epel-release -y
Then install Fail2Ban:
dnf install fail2ban -y
Once installed, Fail2Ban will start automatically and begin monitoring common services.
Step 5: choose your hosting setup (cPanel or web server stack)
There are two common options for hosting sites on a VPS: install cPanel for a graphical interface and easy domain/email/website setup, or install a LAMP stack for more manual control.
Option A: install cPanel/WHM (recommended for most Krystal users)
Krystal customers typically use cPanel to replicate a shared hosting experience, with added power and flexibility.
To install cPanel:
Make sure your server runs AlmaLinux or Ubuntu 22.04 (cPanel supports both).
Log in as root and run:
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
The installation will take some time. Once complete, you'll be able to log in to WHM (Web Host Manager) via:
https://your-server-ip:2087
From there, you can configure your hosting environment, create cPanel accounts, manage DNS, and more.
Note: cPanel requires a licence – you can manage this via your Krystal Client Area.
Option B: install a web server stack manually
This is for users who prefer full control and aren’t using cPanel.
To install a LAMP stack on Ubuntu:
apt install apache2 mariadb-server php libapache2-mod-php php-mysql -y
To install on AlmaLinux:
dnf install httpd mariadb-server php php-mysqlnd -y
Then enable and start the services:
Ubuntu:
systemctl enable apache2
systemctl start apache2
systemctl enable mariadb
systemctl start mariadb
AlmaLinux:
systemctl enable httpd
systemctl start httpd
systemctl enable mariadb
systemctl start mariadb
To secure your database:
mysql_secure_installation
Step 6: secure your VPS
Security is never just a one-time task. Here are some quick wins to help you stay secure:
Use Let’s Encrypt for free SSL certificates via Certbot
Keep your OS and packages updated
Enable automatic security patches
Set up regular backups (Krystal includes monthly snapshots with every VPS)
Step 7: upload your website and point your domain
Once your server is set up and secure, it’s time to launch your site.
1. Upload your website files
You can upload your website using an SFTP client like FileZilla (recommended for beginners) or push code from Git if you’re comfortable with it.
If you’ve installed Apache, your website files should go in this folder on your VPS:
/var/www/html
Make sure to delete the default index.html
file that Apache creates, so your own homepage appears instead.
2. Point your domain name to your VPS
Log into your domain registrar (e.g. Krystal, GoDaddy, Namecheap) and update the A record for your domain to point to your VPS’s IP address. You’ll find that IP in your welcome email or VPS dashboard.
If your domain is managed with Krystal, this part is even easier – and our support team can help if you’re unsure.
3. Restart Apache to apply any changes
Ubuntu:
systemctl restart apache2
AlmaLinux:
systemctl restart httpd
4. Test your site
Open your browser and type in your domain name. You should now see your site live. If not, give it a little time – DNS updates can take a few hours to fully propagate.
Bonus tip: If you’re using Krystal’s VPS platform, don’t forget you also have a 60-day money-back guarantee. It gives you time to get everything up and running with confidence.
What’s next?
If you’ve followed the steps above, congratulations - you’ve built the foundations of a working VPS! It’s more hands-on than shared hosting, but the reward is flexibility: you decide what runs, where, and how.
Next steps:
Learn more about hardening your VPS to keep it secure
Use tools like Git, Docker or custom scripts
If you'd prefer support with server management, Krystal also offers managed VPS hosting, where we monitor your VPS, keep it updated and help guide you through any issues that come up.
That said, VPS isn’t always the best option for every user. If you're mainly looking for more power or capacity without needing full control over server configuration, you might be better served by one of our Business Hosting plans. They include many of the performance benefits of a VPS, with far less setup involved - and often better value when all the maintenance is taken into account.
And as always, if you’re not sure which option suits you best, our team is happy to help. Just get in touch.
Share this article
About the author
Darren H
I'm Darren and I'm the Senior Copywriter at Krystal. Words are what I do. Aside from writing, I play guitar and sing in my band Machineries Of Joy and seek adventure with my wife and daughter.