Build a Sendmail mail server in CentOS
Before setting up, first introduce the environment
- System Environment: CentOS 5.6 32bit
- Domain Name: qiu.com
1. Before creating an MX record, we need to add an MX record to the DNS (in this example, the DNS server address is 192.168.0.1) to test whether the setting takes effect. 2. Online installation program
- Yum-y install sendmail-* main program
- Yum-y install m4-* Configuration Tool
- Yum-y installcyrus-sasl SMTP authentication
- Yum-y install dovecot pop imap receive
3. configure sendmail 1) vi/etc/mail/local-host-names to add mail. qiu. com2) vi/etc/mail/sendmail. mc changes SMTP authentication to accept all hosts, and then dn1 # delete 3) vi/etc/mail/access entry Connection: 192.168.0 RELAY 4) input the command:
- M4/etc/mail/sendmail. mc>/etc/mail/sendmail. cf
- Makemap hash/etc/mail/access. db </etc/mail/access
5) modify the/etc/dovecot. conf file, find the line # protocols = imap imaps pop3 pop3s, and remove. 6) start the mail service
- Services sendmail start
- Services dovecot start
- Services saslauthd start
Don't forget to add it as boot. 6) Add a user and set a password
- Groupadd mail_user # Add a Contact Group
- Useradd-s/sbin/nologin-g mail_user zhang3 # Add a user named zhang3
- Useradd-s/sbin/nologin-g mail_user li4 # Add a user named l4
- Echo Test_zhang3 | passwd -- stdin zhang3 # Set password for Zhang 3 to Test_zhang3
- Echo Test_li4 | passwd -- stdin li4 # Set password for Zhang 3 to Test_li4
Now we can use the MUA client software such as OE Or foxmail to send and receive emails. Next we configure openwebmail. Since openwebmail works on port 80, We need to install httpd (APACHE) first )! 4. Configure openwebmailyum Installation
- Yum-y install lftp
- Lftpget http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
- Yum-y install openwebmail
1) initialize/var/www/cgi-bin/openwebmail/openwebmail-tool.pl -- init 2) vi/var/www/cgi-bin/openwebmail/etc/dbm. conf, modify as follows: dbm_ext. db dbmopen_ext. dbm dbmopen_haslock no3) vi/var/www/cgi-bin/openwebmail/etc/openwebmail. conf domainnames qiu.com # change to your own domain name # default_language zh_CN.GB2312 # change the logon interface to Chinese #4) vi/var/www/cgi-bin/openwebmail/etc/defaults/openwebmail. conf: smtpserver192.168.0.107 # change the smtp server address # authpo P3_server 192.168.0.107 # change the pop3 server address #5) vi/var/www/cgi-bin/openwebmail/etc/defaults/dbm. conf dbmopen_ext. db dbmopen_haslock yes6) re-initialization/var/www/cgi-bin/openwebmail/openwebmail-tool.pl -- init login address: http://mail.qiu.com/cgi-bin/openwebmail/openwebmail.pllogin can display the following information (permissions ): couldn't create File/var/log/openwebmail. log! (Permission denied) solution: touch/var/log/openwebmail. logchcon-u system_u/var/log/openwebmail. logchcon-t httpd_sys_script_rw_t/var/log/openwebmail. logchcon-t httpd_unconfined_script_exec_t/var/www/cgi-bin/openwebmail * If the message "cannot retrieve emails" is displayed, reinitialize it! Final success: