Setting up a Linux server from scratch is one of the most valuable skills in system administration, DevOps, and cybersecurity. It helps you understand how servers actually work under the hood instead of relying on managed services.
In this guide, I’ll walk through how to build a basic Linux server, configure it, and make it ready for real-world use.
Why Build Your Own Linux Server?
A self-built Linux server helps you:
- Understand system internals (users, permissions, services)
- Host applications (web apps, APIs, databases)
- Practice DevOps skills
- Prepare for cybersecurity labs
- Gain full control over your environment
Step 1: Choose Your Linux Distribution
For servers, the most common choices are:
Ubuntu Server (beginner-friendly)
Debian (stable and lightweight)
CentOS / Rocky Linux (enterprise-style systems)
In this guide, we will install Ubuntu Server.
Step 2: Install Linux Server
Get Ubuntu Server from:
Download ISO:Install:
Use VirtualBox, VMware, or physical machine
Select:
Minimal installation
OpenSSH server (IMPORTANT)
Step 3: Configure Network
Check IP address:
ip a
Test internet:
ping google.com
Update system:
sudo apt update && sudo apt upgrade -y
Step 4: Secure Your Server
Create a new user:
sudo adduser user1
Give sudo access:
sudo usermod -aG sudo user1
Enable SSH access
Install SSH (if not installed):
sudo apt install openssh-server -y
Check SSH status:
sudo systemctl status ssh
Change SSH port (basic security step)
sudo nano /etc/ssh/sshd_config
Change:
Port 22 → Port 2222
Restart SSH:
sudo systemctl restart ssh
Step 5: Configure Firewall (UFW)
Enable firewall:
sudo ufw enable
Allow SSH:
sudo ufw allow 2222/tcp
Check status:
sudo ufw status
Step 6: Install a Web Server (Optional but Common)
Install Nginx:
sudo apt install nginx -y
Start service:
sudo systemctl start nginx
Enable on boot:
sudo systemctl enable nginx
Test:
Step 7: Install Database (Optional)
MySQL:
sudo apt install mysql-server -y
Secure installation:
sudo mysql_secure_installation
Step 8: Install Developer Tools
sudo apt install git curl wget unzip -y
Step 9: Monitor Server
Check system usage:
top
Disk usage:
df -h
Memory usage:
free -h
Step 10: Final Test
Try accessing your server:
SSH login:
ssh user1@your-server-ip -p 2222
Open browser:
http://your-server-ip
🚀 What You have:
A secure Linux server
SSH access configured
Firewall protection
Optional web server and database
Basic monitoring tools
Top comments (0)