Project

General

Profile

Support #474

Updated by Daniel Curtis over 9 years ago

One of the core services of the Internet is email, and as such I needed to setup a mail server for one of my projects. Rather than setting up postfix, dovecot, spamassassin, etc. by hand, I found the useful open source project iRedMail. Unfortunately, this project currently is not in the port tree, however the install script uses the ports tree to install each of the necessary packages. This guide uses a FreeBSD 9.2 jail created using FreeNAS, so it should work on a bare metal setup as well; also this guide assumes that SSH has been enabled and a separate user used to run administrative commands has been created. 

 {>toc} 

 h2. Update the system 

 * Login as root: 
 su - 

 * Update the ports tree 
 <pre> 
 portsnap fetch extract 
 </pre> 

 * Install portupgrade 
 <pre> 
 cd /usr/ports/ports-mgmt/portupgrade 
 make install clean 
 </pre> 

 * Upgrade the base system 
 <pre> 
 portupgrade -a 
 </pre> 

 * Check the current hostname: 
 <pre> 
 hostname -f 
 </pre> 
 > mx.example.com 

 On FreeBSD, hostname is set in two files: /etc/rc.conf, /etc/hosts. 

 * Add or modify the /etc/rc.conf file: 
 <pre> 
 hostname="mx.example.com" 
 </pre> 

 * Add or modify the /etc/hosts file: 
 <pre> 
 127.0.0.1     mx.example.com mx localhost localhost.localdomain 
 </pre> 

 h2. Install iRedMail 

 * Install bash 
 <pre> 
 cd /usr/ports/shells/bash 
 portupgrade -Np 
 </pre> 

 * Fetch and extract the iRedMail installer: 
 <pre> 
 cd 
 fetch https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.8.7.tar.bz2 
 tar xjf iRedMail-0.8.7.tar.bz2 
 cd iRedMail-0.8.7 
 </pre> 

 * *NOTE*: On newer FreeBSD systems apache22 is deprecated, and this will break the iRedMail installer since it depends on apache22. In order to fix this problem, run: 
 <pre> 
 echo 'DEFAULT_VERSIONS+=apache=2.2' >> /etc/make.conf 
 </pre> 

 * Run the iRedMail Installer: 
 <pre> 
 bash iRedMail.sh 
 </pre> 

 * *NOTE*: NOTE: During the install I came across the following error: 
 > apache22-2.2.29_2 AUTHN_DBD and DBD requires APR-util to have DBD support build in. Please rebuild APR at last with one DBD backend (MYSQL, PGSQL or SQLITE). 
 #* In order to fix this, I needed to reinstall apr1 (this is to compile the modules required for the database backend): 
 <pre> 
 cd /usr/ports/devel/apr1 
 make reinstall clean 
 </pre> 

 * *NOTE*: During the install I came across an error compiling mod_php5. 
 #* In order to fix this, I needed to install mod_php5 using portupgrade: 
 <pre> 
 portupgrade -Np mod_php5 
 </pre> 

 * Rerun the iRedMail Installer: 
 <pre> 
 cd ~/iRedMail-0.8.7 
 bash iRedMail.sh 
 </pre> 

 h3. Configure iRedMail 

 The install process will pull in all the required packages during installation. Since each mail server is a little different, my setup uses the following parameters: 
 * Default mail storage path: */var/vmail* 
 * Preferred backend used to store mail accounts: *MySQL* 
 * First virtual domain name: *example.com* 
 * Optional components: 
 #* DKIM signing/verification 
 #* iRedAdmin 
 #* Roundcubemail 
 #* phpMyAdmin 
 #* Awstats 

 When the installation finishes, all the login information and URLs will be placed in the *iRedMail.tips* file. 

 h2. Resources 

 * http://www.iredmail.org/docs/install.iredmail.on.freebsd.html 
 * http://www.iredmail.org/download.html

Back