Surgemail Installation

This is my installation of Surgemail as I’m experimenting with it.

  • I’d recommend vising Surgemails website https://surgemail.com
  • I’m installing Surgemail Version 80o, visit the download page for the most current version.
  • This is installed in my homelab environment, not a production environment.

VM Settings

  • 2vCPU (only need 1 but two feels better)
  • 4GB Memory (only need 2)
  • 40GB of Disk, Thin Provision
  • Ubuntu 24.04.03 Minimized Installation
  • Hostname mail.rustysdatabase.com
    • Use your own hostname but this should be the same

Server Installation

  1. Update Server.
    • apt -y update && apt-get -y full-upgrade
  2. Install packages. Only the core packages are needed, however the rest are very useful or can be swapped out, like vim for nano.
    • apt -y install nano curl tar unzip openssl ufw fail2ban certbot clamav clamav-daemon htop net-tools dnsutils rsync
      • Core Surgemail: curl, tar, unzip
      • Security: ufw, fail2ban, certbot
      • Virus Scanning: clamav, clamav-daemon
      • Admin Tools: nano, htop, net-tools, dnsutils, rsync, logrotate
  3. Modify hosts file.
    • nano /etc/hosts
      • Leave the localhost line but change the 127.0.0.1 hostname to the servers internal IP address.
  4. Download Surgemail.
    • curl -O https://netwinsite.com/ftp/surgemail/surgemail_80o_linux64.tar.gz
  5. Extract the tarball.
    • tar -xvzf surgemail_80o_linux64.tar.gz
  6. Change to the extracted directory.
    • cd mtemp
  7. Run the installer.
    • ./install.sh
      • Press enter to accept the defaul install location.
      • Set the domain name, for example, mine will be rustysdatabase.com.
      • Enter the hostname, for example, mine will be mail.rustysdatabase.com.
      • Type “Yes” to enable SPAM Handling Features.
      • Enter a username for Webadmin.
      • Enter a password and confirm it.
      • Enter an email address.
      • The Admin interface is now accessible by the domain name (if setup in DNS and accessible to the internet) or by the private IP
        • mail.rustysdatabase.com:7026
        • 192.168.1.75:7026
  8. Start Surgemail and enable it
    • systemctl start surgemail
    • systemctl enable surgemail
  9. Set UFW rules
    • ufw reset
    • ufw default deny incoming
    • ufw default allow outgoing
    • ufw allow 25/tcp comment ‘SMTP inbound’
    • ufw allow 587/tcp comment ‘SMTP submission (auth clients)’
    • ufw allow 465/tcp comment ‘SMTP over SSL’
    • ufw allow 110/tcp comment ‘POP3’
    • ufw allow 995/tcp comment ‘POP3S’
    • ufw allow 143/tcp comment ‘IMAP’
    • ufw allow 993/tcp comment ‘IMAPS’
    • ufw allow from 192.168.1.0/24 to any port 22 comment ‘SSH LAN only’
    • ufw allow from 192.168.1.0/24 to any port 7026 comment ‘SurgeMail admin HTTPS LAN only’
      • In the commands above, we reset the firewall to defaults (should already be but I like to do it anyways), set the default rules, then set the ports used by Surgemail, and finally set our internal administrative rules.
  10. Enable ufw
    • ufw enable


Comments

Leave a Reply