cs@vps-hosting.org

Setting Up a VPS

3.1 Choosing the Right VPS Provider

Before setting up your VPS, you need to choose a reliable VPS provider. Consider the following factors:

Key Factors to Consider

Performance – Look for SSD or NVMe storage, powerful CPUs, and sufficient RAM.
Pricing – Compare costs based on the specs you need.
Scalability – Ensure you can upgrade resources as needed.
Support – Choose a provider with good customer service.
Data Center Location – Closer servers mean lower latency.
Network Speed – Look for providers with at least a 1 Gbps connection.

Popular VPS Providers

  • Budget VPS: Contabo, Vultr, Linode
  • Cloud-based VPS: DigitalOcean, AWS, Google Cloud
  • Premium VPS: Liquid Web, Kinsta

Once you’ve chosen a provider, purchase a VPS plan based on your needs.


3.2 Selecting the Right Operating System

The next step is to choose an operating system (OS) for your VPS.

OSBest ForPros
UbuntuBeginners, developersEasy to use, large community support
DebianStability-focused usersLightweight, minimal resource usage
CentOS (EOL)Older enterprise setupsSecure, but outdated
Rocky LinuxCentOS replacementStable and enterprise-ready
Windows Server.NET applicationsBest for Windows-based apps

For web hosting or development, Ubuntu or Debian is recommended.


3.3 Accessing Your VPS (SSH & Remote Desktop)

For Linux VPS (SSH Login)

Once your VPS is set up, you’ll receive an IP address, username (root), and password.

  1. Open a terminal on your local machine.
  2. Connect via SSH using this command:bashCopyEditssh root@your-vps-ip
  3. If prompted, type yes and enter your password.

For Windows VPS (Remote Desktop Login)

  1. Open Remote Desktop Connection (RDP) on Windows.
  2. Enter your VPS IP address and click Connect.
  3. Enter your username (Administrator) and password.

3.4 Basic Server Setup & Security Hardening

1️⃣ Update System Packages

Always update your server to get the latest security patches.

For Debian/Ubuntu:

apt update && apt upgrade -y

For CentOS/Rocky Linux:

yum update -y

2️⃣ Change Default Root Password

Use a strong password to secure your VPS.

passwd

3️⃣ Create a New User & Disable Root Login

It’s best to avoid using the root account directly.

Create a new user:

adduser myuser

Give admin (sudo) access:

usermod -aG sudo myuser

Disable root login (edit SSH config file):

nano /etc/ssh/sshd_config

Find PermitRootLogin yes and change it to:

PermitRootLogin no

Restart SSH service:

systemctl restart ssh

4️⃣ Set Up a Firewall (UFW or Firewalld)

For Ubuntu/Debian (UFW):

ufw allow OpenSSH
ufw enable
ufw status

For CentOS/Rocky Linux (Firewalld):

firewall-cmd --permanent --add-service=ssh
firewall-cmd --reload

5️⃣ Install Fail2Ban (Prevents Brute-Force Attacks)

apt install fail2ban -y   # Debian/Ubuntu  
yum install fail2ban -y # CentOS/Rocky
systemctl enable --now fail2ban

3.5 Installing a Web Server (Apache or Nginx)

Most users set up a web server to host websites. The two most popular options are:

Option 1: Apache (Traditional & Versatile)

apt install apache2 -y   # Debian/Ubuntu  
yum install httpd -y # CentOS/Rocky
systemctl enable --now apache2 # Start & enable Apache

Option 2: Nginx (Lightweight & Fast)

apt install nginx -y  
systemctl enable --now nginx

After installation, visit your VPS IP address in a browser to confirm the web server is running.


3.6 Setting Up a Database (MySQL or PostgreSQL)

If your website or application requires a database, install MySQL or PostgreSQL.

Install MySQL

apt install mysql-server -y  
mysql_secure_installation

Install PostgreSQL

apt install postgresql postgresql-contrib -y  
systemctl enable --now postgresql

3.7 Adding a Domain to Your VPS

To connect a domain to your VPS, update the DNS settings in your domain registrar:

  1. Go to your domain registrar’s dashboard (e.g., Namecheap, GoDaddy).
  2. Find the DNS settings for your domain.
  3. Add an A record pointing to your VPS IP address:
    • Host: @ Type: A Record Value: YOUR_VPS_IP TTL: 300 (5 minutes)
  4. Wait for DNS propagation (can take a few minutes to hours).

Conclusion

By following these steps, you’ve successfully set up a VPS, secured it, and installed essential software like a web server and database.

In the next chapter, we’ll explore VPS Management & Optimization, where you’ll learn performance tuning, monitoring, and automation.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa