Skip to content

Deploying Plesk Obsidian on Ubuntu 22.04 — production-ready installer

Stand up Plesk Obsidian on Ubuntu 22.04 with the official auto-installer, license activation, firewall, fail2ban, and post-install hardening — ready for the first customer account.

You spin up a fresh Ubuntu 22.04 VM, paste the Plesk one-liner from the marketing page, and forty minutes later there’s a control panel on :8443 that lets you log in as admin. You hand it to the sales team. Three weeks in, the panel is exposed to the public internet with the default firewall rules wide open, the admin password is in a Confluence page titled “credentials,” the license never got activated because nobody ran the activation command, fail2ban is absent so the /login_up.php endpoint is taking thousands of brute-force attempts a day, and the host is missing the kernel and security patches Ubuntu released the week after install. Plesk is operating; the host underneath it isn’t.

What’s happening

The Plesk auto-installer (plesk-installer) handles only the Plesk product itself. It does not harden Ubuntu, it does not configure UFW, it does not install fail2ban, it does not activate your license, and it does not switch the panel from the self-signed certificate to a real one. A production Plesk node is the auto-installer plus a base layer: kernel/sysctl tuning, UFW with only the ports Plesk actually needs (22, 80, 443, 8443, 8447 for the updater, plus mail and FTP if those services live on this node), SSH hardened to key-only, fail2ban with the Plesk-specific jails turned on, unattended-upgrades for security patches, the license activated via plesk bin license, the admin email moved off the default admin@<hostname>, and the panel TLS replaced with Let’s Encrypt before any human types a password into it. Skip any of these and the panel is functional but the underlying VM is the soft target.

How to verify

After install, only the panel + service ports should be listening on the public interface:

ss -lntp | grep -E ':(22|25|80|110|143|443|465|587|993|995|8443|8447)\b'

Plesk should report itself ready and the license should show as activated:

plesk version
plesk bin server_pref --show
plesk bin license --info | grep -E 'status|key number|activation code'

The admin password should not be the auto-generated one from the installer — it should be the one you rotated and stored in the secrets manager. Verify by listing the admin user:

plesk bin admin --show-info

fail2ban should have at least the SSH, panel, and Plesk-postfix jails active:

fail2ban-client status | grep 'Jail list'
# Jail list: plesk-apache, plesk-apache-badbot, plesk-modsecurity, plesk-panel, plesk-postfix, plesk-roundcube, plesk-wordpress, ssh

If plesk-panel is missing, the brute-force counter against /login_up.php is not being enforced.

The fix

Save the script as /root/setup-plesk-obsidian-ubuntu22.sh and run it on a freshly-provisioned Ubuntu 22.04 VM with a public IPv4 and a fully-qualified hostname that already resolves to that IP. It performs: base update, UFW with only the ports Plesk needs, SSH hardening (key-only, root key preserved), unattended-upgrades, kernel/sysctl tuning for a web/mail host, the Plesk auto-installer in unattended mode with the Recommended preset, license activation, admin password rotation, fail2ban with all Plesk jails enabled, and a real Let’s Encrypt certificate on the panel hostname so the first login isn’t through the self-signed warning.

#!/usr/bin/env bash
set -euo pipefail

### Ubuntu 22.04 Plesk Obsidian production installer
### Activates a license via env var PLESK_ACTIVATION_CODE
### Sets the admin password from env var PLESK_ADMIN_PASSWORD
### Provisions Let's Encrypt for the panel hostname
### Enables fail2ban + UFW + unattended-upgrades
### Reboot remains manual after final apt upgrade

if [[ "$(id -u)" -ne 0 ]]; then
  echo "Run as root."
  exit 1
fi

: "${PLESK_HOSTNAME:?Set PLESK_HOSTNAME=panel.example.com (must already resolve to this VM)}"
: "${PLESK_EMAIL:?Set PLESK_EMAIL=ops@example.com for Let's Encrypt + admin contact}"
: "${PLESK_ACTIVATION_CODE:?Set PLESK_ACTIVATION_CODE=AAAAAA-BBBBBB-CCCCCC-DDDDDD-EEEEEE}"
PLESK_ADMIN_PASSWORD="${PLESK_ADMIN_PASSWORD:-$(openssl rand -base64 24)}"
PLESK_PRESET="${PLESK_PRESET:-Recommended}"

echo
echo "========================================"
echo "Plesk Obsidian on Ubuntu 22.04"
echo "Hostname: ${PLESK_HOSTNAME}"
echo "========================================"
echo

echo "==> Confirming hostname resolves to this host"
resolved_ip="$(getent hosts "${PLESK_HOSTNAME}" | awk '{print $1}' | head -n1)"
public_ip="$(curl -fsS https://api.ipify.org || true)"
if [[ -z "${resolved_ip}" ]]; then
  echo "WARNING: ${PLESK_HOSTNAME} does not resolve yet. Continuing, but Let's Encrypt will fail until DNS is in place."
elif [[ -n "${public_ip}" && "${resolved_ip}" != "${public_ip}" ]]; then
  echo "WARNING: ${PLESK_HOSTNAME} resolves to ${resolved_ip} but this host's public IP is ${public_ip}."
fi

hostnamectl set-hostname "${PLESK_HOSTNAME}"

echo "==> Updating base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y upgrade

echo "==> Installing base packages"
apt-get -y install \
  vim curl wget ca-certificates gnupg2 \
  chrony fail2ban unattended-upgrades \
  ufw lsof tcpdump dnsutils tar gzip \
  iproute2 net-tools openssl jq \
  software-properties-common

systemctl enable --now chrony
timedatectl set-ntp true

echo "==> Kernel/sysctl tuning for a Plesk node"
cat > /etc/sysctl.d/99-plesk.conf <<'SYSCTL'
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

net.core.somaxconn = 4096
net.core.netdev_max_backlog = 250000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.ip_local_port_range = 10240 65535

net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0

kernel.dmesg_restrict = 1
kernel.kptr_restrict = 2
fs.file-max = 2097152
vm.max_map_count = 262144
vm.swappiness = 10
SYSCTL

modprobe tcp_bbr || true
echo tcp_bbr > /etc/modules-load.d/bbr.conf
sysctl --system

cat > /etc/security/limits.d/99-plesk.conf <<'LIMITS'
* soft nofile 64000
* hard nofile 64000
root soft nofile 64000
root hard nofile 64000
LIMITS

echo "==> Configuring UFW (panel + web + mail + FTP)"
ufw --force reset
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp                  # SSH
ufw allow 80/tcp                  # HTTP
ufw allow 443/tcp                 # HTTPS
ufw allow 8443/tcp                # Plesk panel
ufw allow 8447/tcp                # Plesk updater + license server callback
ufw allow 21/tcp                  # FTP control
ufw allow 49152:65534/tcp         # FTP passive
ufw allow 25/tcp                  # SMTP
ufw allow 465/tcp                 # SMTPS
ufw allow 587/tcp                 # Submission
ufw allow 110/tcp                 # POP3
ufw allow 995/tcp                 # POP3S
ufw allow 143/tcp                 # IMAP
ufw allow 993/tcp                 # IMAPS
ufw --force enable

echo "==> Hardening SSH (root key login preserved)"
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%F-%H%M%S)

set_sshd_option() {
  local key="$1"
  local value="$2"
  if grep -qE "^[#[:space:]]*${key}[[:space:]]+" /etc/ssh/sshd_config; then
    sed -i "s|^[#[:space:]]*${key}[[:space:]].*|${key} ${value}|" /etc/ssh/sshd_config
  else
    echo "${key} ${value}" >> /etc/ssh/sshd_config
  fi
}

set_sshd_option PermitRootLogin prohibit-password
set_sshd_option PasswordAuthentication no
set_sshd_option PubkeyAuthentication yes
set_sshd_option KbdInteractiveAuthentication no
set_sshd_option ChallengeResponseAuthentication no
set_sshd_option X11Forwarding no
set_sshd_option ClientAliveInterval 300
set_sshd_option ClientAliveCountMax 2
set_sshd_option MaxAuthTries 4

sshd -t
systemctl restart ssh

echo "==> Unattended security upgrades"
cat > /etc/apt/apt.conf.d/20auto-upgrades <<'AUTOUPG'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "7";
AUTOUPG

echo "==> Running the Plesk auto-installer (${PLESK_PRESET})"
# The auto-installer downloads Plesk and applies the chosen preset non-interactively.
sh <(curl https://autoinstall.plesk.com/one-click-installer) || true
# Re-run via plesk-installer to make sure we're on the latest release and the chosen preset is applied.
plesk installer --select-release-current --install-component panel
plesk installer --select-release-current --install-component preset:"${PLESK_PRESET}"

echo "==> Waiting for Plesk control panel on :8443"
for i in {1..120}; do
  if ss -lntp | grep -q ':8443'; then
    break
  fi
  sleep 2
done

if ! ss -lntp | grep -q ':8443'; then
  echo "Plesk panel did not come up on :8443"
  journalctl -u sw-cp-server --no-pager | tail -200 || true
  exit 1
fi

echo "==> Activating Plesk license"
plesk bin license --install "${PLESK_ACTIVATION_CODE}"
plesk bin license --info | grep -E 'status|key number|expiration'

echo "==> Setting admin contact + password"
plesk bin admin --set-admin-info \
  -name "Operations" \
  -email "${PLESK_EMAIL}" \
  -company "Operations"
plesk bin admin --set-password -passwd "${PLESK_ADMIN_PASSWORD}"

echo "==> Provisioning Let's Encrypt for the panel hostname"
plesk installer --select-release-current --install-component letsencrypt
plesk bin extension --exec letsencrypt cli.php \
  --secure-panel \
  --email "${PLESK_EMAIL}" \
  --domain "${PLESK_HOSTNAME}"

echo "==> Configuring fail2ban with Plesk jails"
plesk bin ip_ban --enable
for jail in ssh plesk-panel plesk-apache plesk-apache-badbot plesk-postfix plesk-roundcube plesk-wordpress plesk-modsecurity; do
  plesk bin ip_ban --enable-jails "${jail}" || true
done
systemctl restart fail2ban
fail2ban-client status

echo "==> Disabling root password auth in Plesk panel users"
plesk bin admin --on-login-redirect-to /admin/

echo "==> Final apt upgrade + cleanup"
apt-get -y upgrade
apt-get -y autoremove
apt-get clean

echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Plesk version:"
plesk version
echo
echo "License:"
plesk bin license --info | grep -E 'status|key number|expiration|activation'
echo
echo "Listeners:"
ss -lntp | grep -E ':(22|25|80|110|143|443|465|587|993|995|8443|8447)\b' || true
echo
echo "fail2ban jails:"
fail2ban-client status | grep 'Jail list:' || true
echo
echo "Admin login URL:"
echo "https://${PLESK_HOSTNAME}:8443/"
echo
echo "Admin password (rotate immediately into your secrets manager):"
echo "${PLESK_ADMIN_PASSWORD}"
echo
echo "Next: rotate the admin password from inside the panel, enable 2FA on the admin user, then create the first reseller plan."

Make it executable and run it with the three required env vars:

chmod 700 /root/setup-plesk-obsidian-ubuntu22.sh
PLESK_HOSTNAME=panel.example.com \
PLESK_EMAIL=ops@example.com \
PLESK_ACTIVATION_CODE=AAAAAA-BBBBBB-CCCCCC-DDDDDD-EEEEEE \
/root/setup-plesk-obsidian-ubuntu22.sh

Once the script completes, log in at https://panel.example.com:8443/ with admin and the rotated password, enable 2FA on the admin user from Tools & Settings → Plesk Login Settings, and create the first reseller plan before you create any customer accounts — putting customers directly under admin makes resource limits ambiguous and complicates revenue reporting later. Confirm the Let’s Encrypt certificate is the one the browser sees (not the Plesk self-signed certificate); the script swaps it via the letsencrypt extension and the --secure-panel flag, but DNS or firewall issues during ACME validation will silently leave the self-signed certificate in place.

Run Plesk under Stack Harbor’s managed Cloud Compute with monthly patching, panel monitoring, and Sev-1 escalation handled by our monitoring + support plane — or scope a Plesk deployment if you’d like us to stand it up and operate it.