Setting Up Your Own Linux Server with Hetzner: A Technical Guide
Jenkins
Source: Dev.to | Jan 11, 2026 (UTC)
Introduction
In an era where cloud services and managed hosting solutions dominate the landscape, the ability to configure and maintain your own Linux server remains a valuable skill for developers. This guide walks through the process of setting up a production-ready Linux server using Hetzner Cloud, covering everything from initial provisioning to essential security hardening.
Why Hetzner?
Hetzner stands out in the VPS market for several compelling reasons:
Cost-effective pricing: Significantly cheaper than AWS, DigitalOcean, or Azure for comparable resources
European data centers: Excellent for GDPR compliance and low-latency European deployments
Transparent pricing: No hidden costs or complex billing structures
Robust infrastructure: German engineering standards with 99.9% uptime SLA
Generous bandwidth allocations: 20TB+ on most plans without overage charges
Prerequisites
Basic Linux command-line knowledge
SSH client installed on your local machine
A Hetzner Cloud account (requires payment method)
Domain name (optional, for web hosting)
🚀 Get €20 Free Credit
Before we dive in, here’s a great opportunity: If you sign up for Hetzner Cloud using this referral link, you’ll receive €20 in free credits. This bonus allows you to use their servers completely free for an extended period – almost 5 months on the smallest plan (CPX11)!
This is an excellent way to test the platform risk-free and see if it fits your needs before committing financially.
Running services as root is a critical security vulnerability.
# Create new user adduser deploy # Add to sudo group usermod -aG sudo deploy # Setup SSH directory for new user mkdir -p /home/deploy/.ssh cp /root/.ssh/authorized_keys /home/deploy/.ssh/ chown -R deploy:deploy /home/deploy/.ssh chmod 700 /home/deploy/.ssh chmod 600 /home/deploy/.ssh/authorized_keys
Enter fullscreen mode
Exit fullscreen mode
Configure SSH Security
Edit SSH daemon configuration:
nano /etc/ssh/sshd_config
Enter fullscreen mode
Exit fullscreen mode
Apply these security-focused changes:
# Disable root login PermitRootLogin no # Disable password authentication PasswordAuthentication no # Disable challenge-response authentication ChallengeResponseAuthentication no # Only allow specific user AllowUsers deploy # Use only SSH Protocol 2 Protocol 2 # Reduce login grace time LoginGraceTime 30 # Maximum authentication attempts MaxAuthTries 3 # Use strong ciphers only Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
Enter fullscreen mode
Exit fullscreen mode
Restart SSH service:
systemctl restart sshd
Enter fullscreen mode
Exit fullscreen mode
Test new connection (in a new terminal before closing root session):
# Find large directories du -sh /* | sort -h # Clean package cache apt clean apt autoremove # Find old log files find /var/log -type f -mtime +30 -name "*.log"
Enter fullscreen mode
Exit fullscreen mode
Advanced Configurations
Docker Installation
# Install Docker curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh # Add user to docker group usermod -aG docker deploy # Install Docker Compose apt install -y docker-compose-plugin
Enter fullscreen mode
Exit fullscreen mode
Automated Deployments with GitHub Actions
# .github/workflows/deploy.yml name: Deploy to Hetzner on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Deploy to server uses: appleboy/ssh-action@master with: host: ${{ secrets.SERVER_IP }} username: deploy key: ${{ secrets.SSH_PRIVATE_KEY }} script: | cd /var/www/app git pull docker-compose up -d --build
Enter fullscreen mode
Exit fullscreen mode
Conclusion
Setting up your own Linux server provides complete control over your infrastructure, deeper understanding of system administration, and significant cost savings for long-term projects. While managed services offer convenience, the skills gained from managing your own server are invaluable for any developer.
Hetzner’s combination of performance, pricing, and reliability makes it an excellent choice for developers looking to self-host applications, learn DevOps practices, or simply escape the vendor lock-in of major cloud providers.
Залишити відповідь