VPS Beginner's Guide
Welcome to the world of VPS! This guide will help complete beginners quickly understand and use VPS.
🤔 What is VPS?
VPS (Virtual Private Server) is a virtualization technology that divides one physical server into multiple virtual servers.
VPS vs Other Hosting Types
Type | Performance | Price | Control | Technical Requirements | Suitable For |
---|---|---|---|---|---|
Shared Hosting | ⭐⭐ | ⭐ | ⭐ | ⭐ | Personal Blogs |
VPS | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | Developers |
Dedicated Server | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | Large Enterprises |
🎯 Why Choose VPS?
Advantages
- ✅ Full Control: Root access, can install any software
- ✅ Cost-Effective: Cheaper than dedicated servers, better performance than shared hosting
- ✅ Scalable: Can upgrade configuration anytime
- ✅ Dedicated IP: Own dedicated IP address
- ✅ Learning Value: Improve Linux and server management skills
Disadvantages
- ❌ Technical Barrier: Requires some Linux knowledge
- ❌ Maintenance Cost: Need to maintain and manage yourself
- ❌ Security Responsibility: Need to handle security issues yourself
📋 Pre-Purchase Preparation
1. Define Requirements
- Purpose: Website, application, learning, testing?
- Traffic: Expected number of users
- Geographic Location: Where are your main users?
- Budget: Acceptable monthly fee range
2. Understand Basic Configurations
CPU (Processor)
- 1 Core: Suitable for small websites, personal blogs
- 2 Cores: Suitable for medium traffic websites, small applications
- 4+ Cores: Suitable for high traffic websites, complex applications
Memory (RAM)
- 512MB-1GB: Basic usage, static websites
- 2GB-4GB: Dynamic websites, small databases
- 8GB+: Large applications, multiple services
Storage
- SSD: Fast speed, recommended
- HDD: Cheap but slow
- Capacity: Choose based on data volume, generally starting from 20GB
Bandwidth/Traffic
- Bandwidth: Affects access speed
- Traffic: Monthly data transfer limit
- Unlimited Traffic: Usually has bandwidth limitations
3. Choose Operating System
Linux Distributions (Recommended for beginners)
- Ubuntu: Most suitable for beginners, rich documentation
- CentOS: Enterprise-grade, good stability
- Debian: Lightweight, low resource usage
Windows Server
- Familiar Windows interface
- Usually more expensive
- Higher resource usage
🛒 How to Buy VPS
Step 1: Choose Service Provider
Choose suitable service provider based on needs:
- International: Vultr, DigitalOcean, Linode
- Domestic: Alibaba Cloud, Tencent Cloud, Huawei Cloud
Step 2: Register Account
- Prepare email and phone number
- Some providers require identity verification
- International providers may require credit card
Step 3: Select Configuration
- Choose data center location
- Choose operating system
- Select server configuration
- Set root password or SSH key
Step 4: Payment
- Supported payment methods vary
- Recommend buying short-term for testing first
- Pay attention to auto-renewal settings
🔧 First Connection to VPS
Get Connection Information
After successful purchase, you will receive:
- IP Address: Server's public IP
- Username: Usually root (Linux) or Administrator (Windows)
- Password: Password you set or system-generated password
Windows User Connection Method
Using PuTTY (Recommended)
- Download and install PuTTY
- Enter server IP address
- Set port to 22
- Click Open to connect
- Enter username and password
Using Windows Terminal
ssh root@your-server-ip
macOS/Linux User Connection Method
Open terminal and enter:
ssh root@your-server-ip
Operations After First Login
1. Update System (Ubuntu/Debian)
apt update && apt upgrade -y
2. Update System (CentOS)
yum update -y
3. Create New User (Optional but recommended)
# Create new user
adduser newuser
# Add to sudo group
usermod -aG sudo newuser
4. Configure Firewall
# Ubuntu
ufw enable
ufw allow ssh
ufw allow 80
ufw allow 443
# CentOS
systemctl start firewalld
systemctl enable firewalld
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
🌐 Build Your First Website
Install Web Server
Method 1: Install Nginx
# Ubuntu/Debian
apt install nginx -y
# CentOS
yum install nginx -y
# Start service
systemctl start nginx
systemctl enable nginx
Method 2: Install Apache
# Ubuntu/Debian
apt install apache2 -y
# CentOS
yum install httpd -y
# Start service
systemctl start apache2 # Ubuntu
systemctl start httpd # CentOS
systemctl enable apache2 # Ubuntu
systemctl enable httpd # CentOS
Create Simple Web Page
# Create HTML file
echo "<h1>Hello, World!</h1><p>My first VPS website!</p>" > /var/www/html/index.html
Access Website
Enter your server IP address in browser, you should see your webpage.
🔒 Basic Security Settings
1. Change SSH Port
# Edit SSH configuration
nano /etc/ssh/sshd_config
# Find #Port 22, change to:
Port 2222
# Restart SSH service
systemctl restart ssh
2. Disable Root Login (Optional)
# Edit SSH configuration
nano /etc/ssh/sshd_config
# Find PermitRootLogin, change to:
PermitRootLogin no
# Restart SSH service
systemctl restart ssh
3. Set Key-based Login
# Generate key pair locally
ssh-keygen -t rsa -b 4096
# Upload public key to server
ssh-copy-id user@server_ip
📚 Common Commands Quick Reference
System Information
# View system information
uname -a
# View memory usage
free -h
# View disk usage
df -h
# View CPU information
cat /proc/cpuinfo
# View running processes
top
File Operations
# List files
ls -la
# Create directory
mkdir dirname
# Delete file
rm filename
# Delete directory
rm -rf dirname
# Copy file
cp source destination
# Move file
mv source destination
Service Management
# Start service
systemctl start servicename
# Stop service
systemctl stop servicename
# Restart service
systemctl restart servicename
# View service status
systemctl status servicename
# Enable auto-start
systemctl enable servicename
🆘 Common Problem Solutions
Cannot Connect to Server
- Check if IP address is correct
- Check if port is correct (default 22)
- Check firewall settings
- Contact service provider to confirm server status
Forgot Password
- Reset through service provider control panel
- Use VNC console to login
- Reinstall system (last resort)
Website Cannot be Accessed
- Check if web server is running
- Check firewall ports (80, 443)
- Check domain resolution (if using domain)
Server Running Slowly
- Check CPU and memory usage
- Check disk space
- View system logs
- Consider upgrading configuration
📖 Advanced Learning Resources
Recommended Tutorials
Useful Tools
- Control Panels: Visual server management
- LAMP/LEMP: One-click web environment installation
- Fail2ban: Prevent brute force attacks
- Certbot: Free SSL certificates
🎉 Congratulations!
After completing this guide, you have:
- ✅ Understood basic VPS concepts
- ✅ Learned how to buy and connect to VPS
- ✅ Mastered basic Linux operations
- ✅ Built your first website
- ✅ Configured basic security settings
Next you can:
- Learn more Linux commands
- Try installing different applications
- Learn Docker container technology
- Explore automated deployment
Continuous Learning
VPS management is a continuous learning process. When encountering problems:
- Search relevant documentation and tutorials first
- Check system logs for clues
- Seek help in community forums
- Contact service provider technical support if necessary