设为首页 收藏本站
查看: 1437|回复: 0

[经验分享] Setup mail server with Postfix, Dovecot, Roundcube

[复制链接]

尚未签到

发表于 2018-10-24 08:32:55 | 显示全部楼层 |阅读模式
Prerequisites

  •   CentOS 6: minimal installation
  •   Postfix: SMTP
  •   Dovecot: IMAP, POP3
  •   Roundcube: web-based IMAP client
  •   Postfix admin: to easily manage Postfix
  To work properly, system needs to have selinux disabled.
  # vi /etc/selinux/config
DSC0000.jpg

Install Postfix
  From the console, install Postfix with yum command.
  # yum install postfix
DSC0001.jpg

  Edit configuration file /etc/postfix/main.cf and set the parameters as follow:
  ______________________________________________________________________
  myhostname = hostname.domain.com
  mydomain = domain.com
  myorigin = $mydomain
  inet_interfaces = all
  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
  mynetworks = 192.168.1.0/24, 127.0.0.0/8
  home_mailbox = Maildir/
  ______________________________________________________________________
  # vi /etc/postfix/main.cf
  ________________________________
  myhostname = hostname.domain.com
  mydomain = domain.com
  myorigin = $mydomain
  ________________________________
DSC0002.jpg

  inet_interfaces = all
   DSC0003.jpg
  mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
   DSC0004.jpg
  mynetworks = 192.168.1.0/24, 127.0.0.0/8
   DSC0005.jpg
  home_mailbox = Maildir/
   DSC0006.jpg
  Once all the parameters have been set, set application to start during system boot and start the service.
  # chkconfig postfix on
  # service postfix start
DSC0007.jpg

Testing Postfix
  To check if everything works as expected, type from console the following commands to send an email:
  # telnet localhost smtp
DSC0008.jpg

  To check if the email has been received, have a look at the /home/username/Maildir/newdirectory.
  # cd /home/username/Maildir/new/
  # ll
  # cat xxxxx.xxxxx.server.domain.com
DSC0009.jpg

  The email wasreceived by the system then the mail server is working properly.
Install Dovecot
  While Postfix acts as Mail Transfer Agent (MTA) only, in order to retrieve emails using modern tools we need to enable IMAP/POP3 protocols. Dovecot is an application that acts as a secureIMAP and POP3 server.
  Use the yum command to install Dovecot.
  # yum install dovecot
DSC00010.jpg

  Edit the configuration file /etc/dovecot/dovecot.conf to enable the needed protocols.
  # vi /etc/dovecot/dovecot.conf
DSC00011.jpg

  Then we need to specify the mail location by editing the file /etc/dovecot/conf.d/10-mail.conf.
  # vi /etc/dovecot/conf.d/10-mail.conf
DSC00012.jpg

  Edit the file /etc/dovecot/conf.d/10-auth.conf and set the following parameters:
  # vi /etc/dovecot/conf.d/10-auth.conf
DSC00013.jpg

DSC00014.jpg

  Last file to edit /etc/dovecot/conf.d/10-master.conf.
  # vi /etc/dovecot/conf.d/10-master.conf
DSC00015.jpg

  Set Dovecot to start at system boot and start the service.
  # chkconfig dovecot on
  # service dovecot start
DSC00016.jpg

Testing Dovecot
  To check if Dovecot is working, we test the program through the POP3 protocol.
  # telnet localhost pop3
DSC00017.jpg

Install Roundcube
  Roundcube is a browser-based IMAP client with an application-like user interface.
  To configure the application, firstly we need to install MySQL server and Apache in the system.
  # yum install mysql-server mysql-devel httpd
DSC00018.jpg

  Enable both MySQL and Apache to start at system boot and enable services.
  # chkconfig mysqld on
  # service mysqld start
  # chkconfig httpd on
  # service httpd start
Install EPEL repository
  To install Roundcube with yum command, we need to install the EPEL repository in the system.
  # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  # rpm -ivh epel-release-6-8.noarch.rpm
DSC00019.jpg

  Once EPEL repo has been installed, use yum to install Roundcube.
  # yum install roundcubemail
DSC00020.jpg

Configure MySQL
  To define the database used by the application, we need to access MySQL configuration.
  # mysql -u root -p
DSC00021.jpg

  Edit configuration file /etc/roundcubemail/db.inc.php to set the parameters to access the database.
  # vi /etc/roundcubemail/db.inc.php
DSC00022.jpg

  Edit the file /etc/roundcubemail/main.inc.php to set the hostname chosen to perform the login.
  # vi /etc/roundcubemail/main.inc.php
DSC00023.jpg

  To make the system accessible outside the server, edit the file/etc/httpd/conf.d/roundcubemail.conf and set the correct parameter.
  # vi /etc/httpd/conf.d/roundcubemail.conf
DSC00024.jpg

  Edit the /etc/php.ini file and set the time zone.
   DSC00025.jpg
  Because the log could report errors>, set the correct encryption parameter.
  # vi /etc/php.d/mcrypt.ini
DSC00026.jpg

  Restart Apache.
  # service httpd restart
Testing Roundcube
  Access Roundcube typing from your browser the address:
  http://IP_address/roundcubemail
  Enter your credential then click Login.
DSC00027.jpg

  The main screen appears showing the email received when Postfix was previously tested.
DSC00028.jpg

Install Postfix Admin
  To make Postfix administration easier, the Postfix admin is a web-based tool used to manage mailboxes, virtual domains and aliases.
  If not already present in the system, install the PHP component needed by the application.
  # yum install php-imap
  Access MySQL and create the database used by Postfix Admin.
  # mysql -u root -p
DSC00029.jpg


  Using the wget command, download the latest>  # wget http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.3.6/postfixadmin-2.3.6.tar.gz
DSC00030.jpg

  Extract the content and move the directory to /var/www/html folder.
  # tar -vxzf postfixadmin-2.3.6.tar.gz
  # mv postfixadmin-2.3.6 /var/www/html/postfixadmin
DSC00031.jpg

  Edit the configuration file /var/www/html/postfixadmin/config.inc.php to enable the applicationand set the password.
  # vi /var/www/html/postfixadmin/config.inc.php
DSC00032.jpg

  Set the correct parameters to access the database previously created.
DSC00033.jpg

  Add the following line to allow the creation of the administration password.
DSC00034.jpg

  Restart Apache.
  # service httpd restart
  To execute the Postfix Admin Setup Checker, type in your browser the address:
  http://IP_address/postfixadmin/setup.php
DSC00035.jpg

  Change the setup password.
DSC00036.jpg

  Create the Superadmin account by filling the fields at the bottom of the screen. Click Add Admin.
DSC00037.jpg

  The Superadmin account is then created.
DSC00038.jpg

  To access the Administration interface, type in your browser the address:
  http://IP_address/postfixadmin
DSC00039.jpg

  The Postfix Admin main screen.
DSC00040.jpg

Sending emails through a>  If the corporate network has an antispam system to checkinbound and outbound emails, Postfix needs to be configured in order to relay the emails to the antispam.
  To allow the correct emails flow, set the relayhost field with the address of the antispam system.
  # vi /etc/postfix/main.cf
DSC00041.jpg

  The mail server is now up and running with the basic functions toproperly manage emailmessages.


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-625688-1-1.html 上篇帖子: Mac下使用终端命令行导入MySQL数据库.sql文件的操作 下篇帖子: pl/sql三种特殊数据类型
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表