Skip to content

Instantly share code, notes, and snippets.

@dominicsayers
Last active April 10, 2023 17:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominicsayers/5115689 to your computer and use it in GitHub Desktop.
Save dominicsayers/5115689 to your computer and use it in GitHub Desktop.
Installing Postfix & Dovecot on a fresh Amazon EC2 Ubuntu Server 12.10 instance and setting it up so all mail to all subdomains goes to one local user with IMAP access.

Instance setup

  1. Make sure the security group is allowing through any ports you need for SMTP & IMAP. Also open port 10000 for Webmin.
  2. You'll want to give it an Elastic IP address so it doesn't wander aimlessly round the IPv4 address space.

Webmin setup

  1. sudo apt-get install ntp ntpdate dkms htop - optional: these are just my favourite things

  2. sudo pico /etc/apt/sources.list and add at the end:

    ## Manually added
    # Webmin
    deb http://download.webmin.com/download/repository sarge contrib
    deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
    
  3. wget http://www.webmin.com/jcameron-key.asc

  4. sudo apt-key add jcameron-key.asc

  5. sudo apt-get update

  6. sudo apt-get install webmin

  7. sudo passwd ubuntu so you can log into Webmin

  8. Go to https://ec2-12-34-56-78.compute-1.amazonaws.com:10000/ (use your own instance of course)

Postfix setup

  1. We'll install Postfix through Webmin so Webmin moves it into the Servers menu properly.

  2. Un-used modules | Postfix Mail Server | click here

  3. Command prompt again

  4. sudo apt-get install postfix-pcre

  5. cd /etc/postfix

  6. sudo pico vdomains and add the line

    /((\w[\w\-]*)\.)+xenap\.to/ OK
    
  7. sudo pico valias and add the line

    /@((\w[\w\-]*)\.)+xenap\.to/ appmail@xenapto.com
    
  8. sudo postmap valias

  9. sudo pico /etc/postfix/main.cf and add the following at the end:

    virtual_alias_domains = pcre:/etc/postfix/vdomains
    virtual_alias_maps = pcre:/etc/postfix/valias
    
  10. sudo service postfix restart

@dominicsayers
Copy link
Author

404 on https://webmin-theme-stressfree.googlecode.com/files/theme-stressfree-2.10.tar.gz

This bit isn't needed any more, Webmin's default theme is OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment