User Tools

Site Tools


ubuntu:email:install_a_full_mail_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ubuntu:email:install_a_full_mail_server [2019/11/27 21:53] – created peterubuntu:email:install_a_full_mail_server [2020/07/15 09:30] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Email - Install a full mail server ======+====== Ubuntu - Email - Install a full mail server ======
  
 ===== Requirements ===== ===== Requirements =====
Line 8: Line 8:
   * DO NOT create "linux users" for every email user – it’s a huge security hole, and a massive pain in the ass for the sysadmin.   * DO NOT create "linux users" for every email user – it’s a huge security hole, and a massive pain in the ass for the sysadmin.
   * DO NOT do mail-relaying.   * DO NOT do mail-relaying.
 +
 +----
  
 ===== What is needed ===== ===== What is needed =====
Line 20: Line 22:
 The database server will be used to manage ALL logins and usernames/passwords. The database server will be used to manage ALL logins and usernames/passwords.
  
 +----
  
 ===== Installation ===== ===== Installation =====
Line 39: Line 42:
   * apt-get install roundcube-mysql   * apt-get install roundcube-mysql
  
 +
 +----
  
 ===== Setup: DNS ===== ===== Setup: DNS =====
Line 44: Line 49:
 You need an "MX" record on your DNS server, and it needs to point to your main server where you’ll run your email, web, etc. You need an "MX" record on your DNS server, and it needs to point to your main server where you’ll run your email, web, etc.
  
 +----
  
 ===== Setup: Web server ===== ===== Setup: Web server =====
Line 51: Line 57:
 Following the idea of http://www.cpierce.org/2012/04/roundcube-for-your-debian-squeeze-mail-server/, I used a much simpler, easier-to-maintain, and easier-to-secure setup. This is documented in the Debian package docs too. Following the idea of http://www.cpierce.org/2012/04/roundcube-for-your-debian-squeeze-mail-server/, I used a much simpler, easier-to-maintain, and easier-to-secure setup. This is documented in the Debian package docs too.
  
 +
 +----
  
 ==== Create a web address for your webmail ==== ==== Create a web address for your webmail ====
Line 72: Line 80:
 Note: replace “[the domain name]” with the domain name, e.g. "domain1.com" Note: replace “[the domain name]” with the domain name, e.g. "domain1.com"
  
 +----
  
 ===== Setup: create databases ===== ===== Setup: create databases =====
Line 82: Line 91:
  
 …or use your preferred softare (e.g. phpMyAdmin). …or use your preferred softare (e.g. phpMyAdmin).
 +
 +----
  
 ==== Create the database ==== ==== Create the database ====
Line 135: Line 146:
 ); );
 </code> </code>
 +
 +----
  
 ==== Create a database-account to access the database ==== ==== Create a database-account to access the database ====
Line 146: Line 159:
 Note: this account will ONLY be accessible by our software running on the server; you cannot access this account remotely (over the internet). Note: this account will ONLY be accessible by our software running on the server; you cannot access this account remotely (over the internet).
  
 +----
  
 ==== Create your first email account and domain ==== ==== Create your first email account and domain ====
Line 156: Line 170:
  
 Note: this password is used over the internet when you login to webmail – so pick a good one! This has to be secure! Note: this password is used over the internet when you login to webmail – so pick a good one! This has to be secure!
 +
 +----
  
 ==== Create a redirector for an email address ==== ==== Create a redirector for an email address ====
Line 165: Line 181:
 Note: only set this up if you actually want a redirect. Note: only set this up if you actually want a redirect.
  
 +----
  
 ===== Setup: Configure Exim4 ===== ===== Setup: Configure Exim4 =====
Line 174: Line 191:
 </code> </code>
  
 +----
  
 ==== Debian: set the global / initial Exim config ==== ==== Debian: set the global / initial Exim config ====
Line 218: Line 236:
 Note: replace “[PUT YOUR SERVER’s IP ADDRESS HERE]” with e.g. “10.0.0.1” (whatever your public internet address is) Note: replace “[PUT YOUR SERVER’s IP ADDRESS HERE]” with e.g. “10.0.0.1” (whatever your public internet address is)
  
 +----
  
 ==== Setup Exim: Macros ==== ==== Setup Exim: Macros ====
Line 245: Line 264:
 Note: “hide mysql_servers” isn’t “hiding” anything – it’s an ESSENTIAL step! It actually means “use this database server”. Terrible config name :(. Note: “hide mysql_servers” isn’t “hiding” anything – it’s an ESSENTIAL step! It actually means “use this database server”. Terrible config name :(.
  
 +----
  
 ==== Setup Exim: Routers ==== ==== Setup Exim: Routers ====
Line 332: Line 352:
                    domains.active=1}}                    domains.active=1}}
 </file> </file>
-     + 
 +---- 
  
 ==== Setup exim: Transports ==== ==== Setup exim: Transports ====
Line 361: Line 382:
 </file> </file>
  
 +----
  
 ==== Setup exim: Auth ==== ==== Setup exim: Auth ====
Line 396: Line 418:
 </file> </file>
  
 +----
  
 ===== Setup: Configure Dovecot ===== ===== Setup: Configure Dovecot =====
Line 406: Line 429:
  
 Note: Dovecot installs with almost everything "Commented out". Many of these options exist commented-out, you should find them in the config file, and put your "new" values on the line below, so it’s easy in future to find them and see which "defaults" you changed. Note: Dovecot installs with almost everything "Commented out". Many of these options exist commented-out, you should find them in the config file, and put your "new" values on the line below, so it’s easy in future to find them and see which "defaults" you changed.
 +
 +----
  
 ==== Dovecot: find your "mail" linux user ==== ==== Dovecot: find your "mail" linux user ====
Line 425: Line 450:
 the first 8 is your uid, the second 8 is your gid (could be different numbers on your server) the first 8 is your uid, the second 8 is your gid (could be different numbers on your server)
  
 +----
  
 ==== Dovecot: all config files ==== ==== Dovecot: all config files ====
Line 462: Line 487:
 Note: replace [YOUR UID] and [YOUR GID] with correct numbers (that you found out using cat /etc/passwd) Note: replace [YOUR UID] and [YOUR GID] with correct numbers (that you found out using cat /etc/passwd)
  
 +----
  
 ===== Setup: Configure Roundcube ===== ===== Setup: Configure Roundcube =====
Line 476: Line 501:
 In that file, there are instructions on how to make it automatically calculate the address using %n, %d, etc. If your MX records for your different domains follow the same pattern (e.g. they are all “mail.my-domain.com”), and your webmail login addresses all follow the same pattern (e.g. "wemail.my-domain.com"), you can put one string here and it will automatically log people into the right server in every case, based on the URL they visited. In that file, there are instructions on how to make it automatically calculate the address using %n, %d, etc. If your MX records for your different domains follow the same pattern (e.g. they are all “mail.my-domain.com”), and your webmail login addresses all follow the same pattern (e.g. "wemail.my-domain.com"), you can put one string here and it will automatically log people into the right server in every case, based on the URL they visited.
  
 +----
  
 ===== Restart EVERYTHING ===== ===== Restart EVERYTHING =====
Line 492: Line 518:
 Exim may output a "paniclog". If so, read it, fix it – and then manually delete the paniclog file, or else you’ll keep getting fake warnings every time you restart exim. Exim may output a "paniclog". If so, read it, fix it – and then manually delete the paniclog file, or else you’ll keep getting fake warnings every time you restart exim.
  
 +----
  
 ===== Debugging – making it work! ===== ===== Debugging – making it work! =====
Line 571: Line 598:
 After doing that, I found webmail go from “takes 5 seconds per click” to “most clicks have immediate effect” (on my fast broadband). After doing that, I found webmail go from “takes 5 seconds per click” to “most clicks have immediate effect” (on my fast broadband).
  
 +----
  
 ===== What you should do next… ===== ===== What you should do next… =====
Line 584: Line 612:
 …those should be easy to find separate guides for. Good luck. …those should be easy to find separate guides for. Good luck.
  
 +----
  
 ===== 2016 Update ===== ===== 2016 Update =====
Line 593: Line 622:
   - In the file /etc/dovecot/conf.d/auth-sql-conf.ext uncomment driver and set it to mysql   - In the file /etc/dovecot/conf.d/auth-sql-conf.ext uncomment driver and set it to mysql
   - /etc/dovecot/conf.d/10-mail.conf uncomment first_valid_uid and set it to [your_uid] (ie. 8). If you need to do the same for first_valid_gid   - /etc/dovecot/conf.d/10-mail.conf uncomment first_valid_uid and set it to [your_uid] (ie. 8). If you need to do the same for first_valid_gid
 +
 +----
  
 ===== Comments ===== ===== Comments =====
Line 601: Line 632:
 Option “CONCAT” unknown. Usually due to incorrect version of exim4. Option “CONCAT” unknown. Usually due to incorrect version of exim4.
  
 +----
  
 ===== References ===== ===== References =====
Line 613: Line 644:
  
 http://alex.mamchenkov.net/2010/06/24/exim-dovecot-and-mysql/ http://alex.mamchenkov.net/2010/06/24/exim-dovecot-and-mysql/
 +
ubuntu/email/install_a_full_mail_server.1574891591.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki