VOOZH about

URL: https://dev.to/nexdam/how-to-set-up-a-secure-linux-server-from-scratch-in-2026-40o7

⇱ How to Set Up a Secure Linux Server from Scratch in 2026 - DEV Community


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

3. Create a Non-Root User

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

adduser davide
usermod -aG sudo davide

4. Configure SSH

Disable root login and password authentication:

nano /etc/ssh/sshd_config

Set:

  • PermitRootLogin no
  • PasswordAuthentication no

5. Set Up a Firewall

ufw allow OpenSSH
ufw allow 80
ufw allow 443
ufw enable

6. Install Nginx

sudo apt install nginx -y
sudo systemctl enable nginx

7. SSL with Let's Encrypt

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com

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.