Debian Wheezy Mail Server – Postfix Dovecot Sasl My. SQL Postfix. Admin Round. Cube Spam. Assassin Clamav Greylist Nginx PHP5 – Xen. Lens. This is a tutorial on how to install an email server on Debian Wheezy 7. We are going to install the following components: E- mail server: Postfix. Dovecot. Sasl library. My. SQLMilters: Spam. ![]() Debian Wheezy Mail Server – Postfix Dovecot Sasl MySQL PostfixAdmin RoundCube SpamAssassin Clamav Greylist Nginx PHP5. This tutorial will guide you through installing a iRedMail Server on RHEL, CentOS, Scientific Linux and Debian, Ubuntu, Linux Mint with Postfix. Assassin. Clamav. Greylist. Webserver: Nginx. PHP5php. My. Admin. Postfix. Admin. Round. Cube. Please replace any text in red with your info. Here is a scheme about the internals, click on image to get a clear view: 1. Install Debian Wheezy 7. When installing Debian 7 itself, only select ‘SSH server’ when prompted to select software. If Debian is ready, install the following packages: apt- get install sudo mc vim. Install My. SQL server and clientapt- get install mysql- server mysql- client. ![]()
Enter a My. SQL root password when prompted. Check that mysqld is running: ps aux. Install PHP5 and Nginx. At this point I use the Dotdeb repo to install PHP version 5. Add Dotdeb repositories to /etc/apt/sources. Add Dotdeb key: wget http: //www. Update apt cache: apt- get update. Install PHP5 and Nginx: apt- get install php. Make sure php. 5- fpm and nginx are running: service php. Create a folders to store web files: mkdir /home/clients_ssl. Create nginx config for this site: vi /etc/nginx/sites- available/< subdomain. Press ‘i’ and paste the following in vim, replace < yourip> and < subdomain. HTTPS on. location ~ /\. Remove the default site and put your site online: rm /etc/nginx/sites- available/default. Create the certs folder. Put your cerificates in there. Get a valid certificate from a certificate authority or create a self signed certificate. You can google on how to make one. Make sure to edit your Nginx config file to match the certificate filenames. Restart Nginxservice nginx restart. Create a php. 5- fpm config file: vi /etc/php. Press ‘i’ and paste the following in vim, replace < subdomain. Create a user for this virtualhost: groupadd - g 1. Create socks folder: mkdir /etc/php. Remove the default php pool: rm /etc/php. Add timezone info to php ini file /etc/php. Europe/Tallinn. Restart php. Install php. My. Admincd /home/clients_ssl/< subdomain. My. Admin/4. 0. 8/php. My. Admin- 4. 0. 8- english. My. Admin- 4. 0. 8- english. Hide pma or bots will try to hack into it: mv php. My. Admin- 4. 0. 8- english pma_7. Set the right owner for www and tmp folder: cd /home/clients_ssl/< subdomain. R 1. 00. 1. 1. 00. Now you should be able to access pma at: https: //< subdomain. Now open php. My. Admin and click on ‘SQL’ on the top menubar. Paste the following SQL queries to create a database and user, replace < password> as you see fit: CREATE DATABASE postfix. GRANT ALL PRIVILEGES ON postfix.* TO 'postfix_admin'@'%' IDENTIFIED BY '< dbpassword. GRANT SELECT ON postfix.* TO 'postfix'@'%' IDENTIFIED BY '< dbpassword. FLUSH PRIVILEGES; 5. Install Postfix. Admin. Although you can install it from a standard Debian package I am going to download it directly instead so I can put it under my custom path immediately. R 1. 00. 1. 1. 00. Now edit configuration file config. CONF['configured'] = true. CONF['postfix_admin_url'] = 'https: //< subdomain. CONF['database_type'] = 'mysqli'. CONF['database_host'] = 'localhost'. CONF['database_user'] = 'postfix_admin'. CONF['database_password'] = '< dbpassword. CONF['database_name'] = 'postfix'. CONF['domain_path'] = 'YES'. CONF['domain_in_mailbox'] = 'NO'. CONF['fetchmail'] = 'NO'; Go to https: //< subdomain. This setup script should create the nesessary tables to postfix database. At the bottom of setup. Gererate password hash’. Edit config. inc. CONF['setup_password'] = '< hash> '; Now enter superadmin account info. You can use this to access Postfix. Admin and configure domains, e- mail accounts, aliases etc. Try to log in with the admin account here: https: //< subdomain. Install Postfix and Sasl libraryapt- get install postfix postfix- mysql libsasl. When prompted, choose ‘Internet Site’. Use yor domain name as ‘System mail name’: < subdomain. For example use ‘mail. Do not use ‘yourdomain. Create virtual mail user and group: groupadd - g 3. Edit /etc/postfix/main. Create the following files: /etc/postfix/mysql_virtual_mailbox_domains. SELECT domain FROM domain WHERE domain='%s' and backupmx = 0 and active = 1/etc/postfix/mysql_virtual_mailbox_maps. SELECT maildir FROM mailbox WHERE username='%s' AND active = 1/etc/postfix/mysql_virtual_alias_maps. SELECT goto FROM alias WHERE address='%s' AND active = 1/etc/postfix/mysql_relay_domains. SELECT domain FROM domain WHERE domain='%s' and backupmx = 1/etc/postfix/sasl/smtpd. SELECT password FROM mailbox WHERE username = '%u@%r' AND active = 1. Add postfix user to sasl group: adduser postfix sasl. Enable secure smtp ports, edit /etc/postfix/master. ORIGINATING. smtps inet n - - - - smtpd. ORIGINATING7. Install Dovecotapt- get install dovecot- imapd dovecot- pop. Create file /etc/dovecot/dovecot- mysql. MD5- CRYPT. user_query = SELECT '/home/vmail/%d/%n' as home, 3. AS uid, 3. 00. 0 AS gid FROM mailbox WHERE username = '%u'. SELECT password FROM mailbox WHERE username = '%u'Edit /etc/dovecot/conf. Edit /etc/dovecot/conf. INDEX=/home/vmail/%d/%n/indexes. Edit /etc/dovecot/conf. Edit /etc/dovecot/conf. Edit /etc/dovecot/conf. Path for SQL configuration file, see example- config/dovecot- sql. Edit /etc/dovecot/conf. Postfix smtp- auth. Restart services: service dovecot restart. You can now add a domain with Postfix. Admin and test your e- mail server. Any errors are found in logfiles: /var/log/auth. Install Miltersapt- get install clamav- milter clamav- unofficial- sigs milter- greylist spamass- milterclamav- milter: Update Clam. Av database and start the daemon: freshclam. Edit /etc/default/clamav- milter and uncomment the last line: SOCKET_RWGROUP=postfix. Create a socket folder inside Postfix chroot environment: mkdir /var/spool/postfix/clamav. Configure Clam. Av milter: dpkg- reconfigure clamav- milter. Answer questions as follows: Handle configuration automatically - -> yes. User for daemon - -> clamav. Additional groups - -> none (empty field). Rejecting harmful e- mail: %v found. LOG_LOCAL6. verbose logging - -> no. Tell Postfix to use this new milter: postconf - e 'smtpd_milters = unix: /clamav/clamav- milter. Edit /etc/default/spamass- milter: Add ‘- m’ so it won’t change the subject header. Add ‘- r - 1’ so Postfix rejects what Spam. Assassin flags as spam. Add ‘- l’ to avoid scanning e- mails sent by logged in users. OPTIONS="- u spamass- milter - i 1. I"Restart milter: service spamass- milter restart. Add a dedicated user for Spam. Assassin daemon: adduser - -shell /bin/false - -home /var/lib/spamassassin - -disabled- password - -disabled- login - -gecos "" spamd. Edit /etc/default/spamassassin: ENABLED=1. OPTIONS="- -create- prefs - -max- children 5 - -helper- home- dir=/var/lib/spamassassin - u spamd - g spamd". CRON=1. Update rules and restart the daemon: sa- update. Tell Postfix to use new milter: postconf - e 'smtpd_milters = unix: /clamav/clamav- milter. Edit /etc/milter- greylist/greylist. For sendmail use the following two lines. For Postfix uncomment the following two lines and comment out the. Edit /etc/default/milter- greylist: ENABLED=1. SOCKET="/var/spool/postfix/milter- greylist/milter- greylist. Make a folder for the socket and restart milter: mkdir /var/spool/postfix/milter- greylist. Tell Postfix to use the new milter: postconf - e 'milter_connect_macros = i b j _ {daemon_name} {if_name} {client_addr}'. Install Round. Cubewget 'http: //downloads. R 1. 00. 1. 1. 00. Open php. My. Admin SQL window and paste: CREATE DATABASE roundcube. GRANT ALL PRIVILEGES ON roundcube.* TO roundcube@localhost IDENTIFIED BY '< rcpassword> '. FLUSH PRIVILEGES; Add initial tables and data: cd /home/clients_ssl/< subdomain. SQL/mysql. initial. Go to https: //< subdomain. See that your environment is ok and click Next. On the ‘Create config’ page, you may want to change the following values: product_name: < yourproductname>. USClick Continue. Change the value in textarea to: $rcmail_config['use_https'] = true; Then copy all from textarea and paste the contents to main. Remove installer folder: mv installer ././Open Round. Cube at https: //< subdomain. This is it ?If this was of any use please link back to this tutorial. Thank you. Sources used to build this tutorial: https: //library. Server World - Build Network Server.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |