How to Set Up a Secure Linux Server from Scratch in 2026

How to Set Up a Secure Linux Server from Scratch in 2026

# linux# server# security# devops
How to Set Up a Secure Linux Server from Scratch in 2026NexDam

How to Set Up a Secure Linux Server from Scratch in 2026 Setting up a Linux server might...

How to Set Up a Secure Linux Server from Scratch in 2026

Setting up a Linux server might seem intimidating at first, but with the right steps you can have a secure and production-ready environment in no time.

1. Choose Your Distribution

Ubuntu Server LTS is the most popular choice for production servers. It offers long-term support, a large community, and excellent documentation.

2. Initial Setup

After installation, the first thing to do is update all packages:

sudo apt update && sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

3. Create a Non-Root User

Never run your server as root. Create a dedicated user:

adduser davide
usermod -aG sudo davide
Enter fullscreen mode Exit fullscreen mode

4. Configure SSH

Disable root login and password authentication:

nano /etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode

Set:

  • PermitRootLogin no
  • PasswordAuthentication no

5. Set Up a Firewall

ufw allow OpenSSH
ufw allow 80
ufw allow 443
ufw enable
Enter fullscreen mode Exit fullscreen mode

6. Install Nginx

sudo apt install nginx -y
sudo systemctl enable nginx
Enter fullscreen mode Exit fullscreen mode

7. SSL with Let's Encrypt

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
Enter fullscreen mode Exit fullscreen mode

A secure server is the foundation of any reliable web project. At NexDam we handle all of this for our clients so they can focus on their business.