Debian Server Setup

Complete guide for installing and configuring Debian 13 (Trixie) (server or Cinnamon Desktop) with Apache webserver, SSH server, PHP, and MariaDB.

Installation

Download the Debian 13 (Trixie) installer ISO from debian.org and install with:

Step 1: Log in as Root

After installation, log in as the root user. Open the terminal and verify you are root by checking for the # symbol:

root@vps#

If you see # instead of $, you are logged in as root and do not need to prefix commands with sudo.

Step 2: Update System

Update package lists and upgrade all installed packages:

apt update
apt upgrade -y

Step 3: Install Essential Tools

Install commonly needed utilities:

apt install -y curl wget git nano htop net-tools ufw sudo

Step 4: Create a Regular Sudo User (Before Hardening SSH!)

Do not use root for daily tasks, and always create and test a regular sudo user before disabling root SSH login:

adduser username
usermod -aG sudo username

Open a second terminal session, log in as username, and verify sudo access works (sudo -v) before restricting root login in Step 6.

Step 5: Configure Apache Webserver

If not already installed, install Apache:

apt install -y apache2

Start and enable Apache:

systemctl start apache2
systemctl enable apache2

Test by visiting your server's IP address in a browser. You should see the Apache default page.

Step 6: Configure SSH Server

The OpenSSH server should already be installed. Secure it by editing its configuration:

nano /etc/ssh/sshd_config

Recommended settings (only set PermitRootLogin no after confirming your new sudo user can log in!):

Restart SSH:

systemctl restart ssh

Keep your current root session open until you verify that a new SSH connection with username succeeds.

Step 7: Configure Firewall

Allow the required ports before enabling UFW. If you changed Port in Step 6 (for example, to 2222), allow that custom port instead of 22/tcp so you do not lock yourself out:

ufw allow 22/tcp    # Replace 22 with your custom SSH port if changed
ufw allow 80/tcp    # HTTP
ufw allow 443/tcp   # HTTPS
ufw enable

Check firewall status:

ufw status

Step 8: Install Additional Software

PHP for web development

apt install -y php php-mysql php-curl php-gd php-mbstring
systemctl restart apache2

MariaDB database

apt install -y mariadb-server
mariadb-secure-installation

Optional: Desktop Customization

If using Cinnamon Desktop, you can customize settings via the built-in System Settings (cinnamon-settings) and dconf-editor:

apt install -y dconf-editor

Maintenance Commands

Check system logs:

journalctl -xe

Monitor system resources:

htop

Check disk usage:

df -h

Upgrading to Newer Debian Releases

When a newer stable Debian release becomes available (or when upgrading an existing Debian 12 bookworm system to Debian 13 trixie), follow the Upgrade Debian to Latest Version guide.

User