How to Set Up a VPS from Scratch (Linux-Based)

How to Set Up a VPS from Scratch (Linux-Based)
So you’ve just purchased your Linux-based VPS (Virtual Private Server) from Vicservers congratulations! You now have more control, better performance, and greater flexibility than shared hosting can offer.
But what do you do next?
If you’re new to VPS hosting, the setup process may seem a little intimidating. Fear not—this comprehensive step-by-step guide will walk you through setting up your Linux VPS from scratch, covering everything from logging in via SSH to securing your server and hosting a basic website.
What You’ll Learn:
- What a VPS is and why Linux is a solid choice
- Connecting to your VPS via SSH
- Updating your system
- Creating a new user and hardening root access
- Setting up a firewall
- Installing essential software (Nginx, Apache, MySQL, etc.)
- Hosting a website on your VPS
- Backups, monitoring, and future steps
Let’s get started.
1. What Is a VPS (and Why Use Linux)?
A Virtual Private Server (VPS) is a virtualized machine running its own copy of an OS—often Linux. You get full control of your environment: install software, configure settings, host websites or apps, and manage resources.
Why Linux?
- It’s open source, lightweight, and extremely secure
- Popular Linux distributions like Ubuntu, Debian, and CentOS are supported by most applications
- You can automate nearly everything from the command line
At Vicservers, all our VPS plans offer full root access and the ability to choose your preferred Linux distro.
2. Connecting to Your VPS via SSH
Prerequisites:
- IP address of your VPS (sent in your welcome email)
- SSH client (Terminal for macOS/Linux, PuTTY for Windows)
- Login credentials (usually root)
SSH Command:
ssh root@your_vps_ip
On first connection, you may see a warning about authenticity—type yes to proceed.
Tip: Always change your root password after your first login using
passwd
.
3. Update and Upgrade the System
Before installing anything, make sure your VPS is up to date.
For Ubuntu/Debian:
apt update && apt upgrade -y
For CentOS/RHEL:
yum update -y
Keeping your packages updated is critical for security and stability.
4. Create a New User and Disable Root Login
Using the root account for everything is risky. Instead, create a new user with sudo privileges.
Create a new user:
adduser yourusername
Grant sudo access:
usermod -aG sudo yourusername
Now, test it:
su - yourusername
sudo ls
Disable root login (optional but highly recommended):
Edit the SSH config file:
sudo nano /etc/ssh/sshd_config
Find:
PermitRootLogin yes
Change to:
PermitRootLogin no
Then restart SSH:
sudo systemctl restart ssh
5. Set Up a Basic Firewall (UFW)
A firewall controls which traffic is allowed. UFW (Uncomplicated Firewall) is perfect for beginners.
Enable UFW:
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
For web servers, also allow:
sudo ufw allow http
sudo ufw allow https
Now you’ve got a basic firewall in place. ✅
6. Install a Web Server
There are two main options: Apache and Nginx. We’ll cover both.
To install Apache:
sudo apt install apache2 -y
To install Nginx:
sudo apt install nginx -y
Once installed, test it by visiting your IP in a browser:
http://your_vps_ip
You should see the default welcome page.
7. Install and Configure MySQL (Optional)
If your website needs a database (WordPress, CMS, etc.), you’ll want to install MySQL or MariaDB.
To install MySQL:
sudo apt install mysql-server -y
Run secure installation:
sudo mysql_secure_installation
Follow the prompts to:
- Set a root password
- Remove anonymous users
- Disallow remote root login
- Remove test databases
Test MySQL:
sudo mysql -u root -p
8. Upload Your Website
There are a few ways to upload your website files:
Option 1: SFTP (recommended)
Use an FTP client like FileZilla and connect with:
- Protocol: SFTP
- Host: your VPS IP
- Username: your user
- Password or SSH key
Upload your site files to:
- Apache:
/var/www/html
- Nginx:
/var/www/html
or your custom location
Option 2: Git
If you’re using Git:
git clone https://github.com/yourrepo.git /var/www/html
Set permissions:
sudo chown -R www-data:www-data /var/www/html
9. Test Your Website
Visit http://yourdomain.com
(if you’ve pointed your domain to the VPS) or http://your_vps_ip
.
If you’ve set everything up, you should see your website live!
Bonus: Enable SSL
Use Let’s Encrypt to install a free SSL certificate:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx
Follow prompts to secure your site.
10. Monitor, Maintain & Backup
Now that your VPS is live, keep it healthy.
Set up automatic updates:
sudo apt install unattended-upgrades
Backup regularly:
- Use
rsync
or automated tools like Duplicity - Consider offsite backups (VicServers offers backup services)
Monitor performance:
Install tools like:
htop
– for CPU/memory usagefail2ban
– to block brute-force login attemptsufw
– to keep your firewall tuned
Final Tips
- Avoid running everything as root
- Keep your OS and software up to date
- Use strong, unique passwords or SSH keys
- Consider installing a control panel (e.g., Webmin, VestaCP, or CyberPanel) for easier management
Why Use Vicservers for Your VPS Hosting?
At Vicservers, we make VPS hosting simple, secure, and scalable:
✅ Instant deployment
✅ Multiple Linux distributions
✅ Root access and full control
✅ SSD storage for fast performance
✅ 24/7 expert support
✅ Optional control panels and managed VPS plans
Whether you’re a developer, entrepreneur, or agency, we’ve got a VPS that fits your needs and grows with you.
Get Started with Vicservers Today!
Ready to deploy your first VPS?
Visit Vicservers.com
✔️ Choose your Linux distro
✔️ Pick your plan
✔️ Deploy in minutes
And if you need help at any step — from setup to security — our support team is here 24/7.