RedHatEnterpriseLinux5.4 build a complete Postfix email server (couri

Source: Internet
Author: User
Tags imap install openssl openssl version
The instructor asked me to set up an email server and searched for some tutorials online, but all of them were wrong. After three and a half days of hard work, I finally completed the setup and thanked the seniors who wrote the tutorials, the following is my summary. (Authmysql. so and athlib connect to the mysql configuration file with a space after the user name ten millions of attention, I am not a shack) I. Install the postfix Mail Server

The instructor asked me to set up an email server and searched for some tutorials online, but all of them were wrong. After three and a half days of hard work, I finally completed the setup and thanked the seniors who wrote the tutorials, the following is my summary.

(Authmysql. so and athlib connect to the mysql configuration file with a space after the user name ten millions of attention, I am not a shack)

1. List of software required for installing the postfix email server: (you can use the new version of the software)
REdHats as 4.0
RedHat Advanced Server Operating System
2. Postfix
This is naturally indispensable. The smtp server of the mail server system acts as the MTA in the mail server system. Software Version: postfix-2.4.5
:
Http://www.postfix.org/download.html
3. mysql
One of the best open-source databases, used to store virtual domain and virtual account information. Version used: mysql-5.0.45
:
Http://dev.mysql.com/downloads/mysql/5.0.html
4. apache
One of the best web server software, usedExTman background management, extmail web mail sending and receiving.
Software Version:Httpd-2.2.4
:
Http://www.apache.org
5,Php
Extman & extmail needs to use php. Function version: php-5.2.3
:
Http://www.php.net
6. cyrus-sasl
Smtp server for authentication using version: cyrus-sasl-2.1.22
:
Http://download.chinaunix.net/download/0001000/71.shtml
7. courier-authlib
Implement pop3 server with verification using version: courier-authlib-0.58
:
Http://download.chinaunix.net/download/0002000/1788.shtml
8. courier-imap
Used to achieve pop3, imap mail receiving function, use version: courier-imap-4.1.0
:
Http://download.chinaunix.net/do... 6 & ResourceId= 77
9. openssl
Provides secure mail server connection with version: openssl-0.9.8e
:
Http://www.openssl.org/source
10. extman
For background management of the mail server, using version: extman-0 [1]. 2.2
:
Http://www.extmail.org
11. extmail
Used to implement webmail. Version: extmail-1 [1]. 0.2
:
Http://www.extmail.org
12. DBD-Mysql
Used to resolve dependencies, extmail will use, using version: DBD-Mysql-3.0002_4
:
Http: // search.CpAn.org
13. Unix-Syslog
Used to resolve dependencies, extmail will use, using version: Unix-Syslog-0.100
:
Http://search.cpan.org
14. BerkeleyDB
Version: BerkeleyDB-4.5.20
:
Http://www.oracle.com/technology... keley-db/index.html

Ii. Installation of the email server system
Conventions: by defaultCompressionThe installation files are stored in the/root directory unless otherwise specified.


Disable selinux
[Root @ www.linuxidc.com root] # vi/etc/selinux/conifg
# ThisFileConTrOLsTheStatE of SELinux on the system.
# SELINUX = can take one of these three values:
# Enforcing-SELinux security policy isenforced.
# PeRmIssive-SELinux prints warnings instead ofenforcing.
# Disabled-SELinux is fully disabled.
Set SELINUX = enforcing
Change
SELINUX = disabled
# SELINUXTYPE = type of policy in use. Possible values are:
# Targeted-Only targeted network daemons areprotected.
# Strict-Full SELinux protection.
SELINUXTYPE = targeted
Selinux is a mandatory security mechanism in linux, but it also brings a lot of trouble. In order to avoid unnecessary troubles, we should turn it off first. When I installed the email server on Fedora cora 5, I had to worry about it for a while because selinux was not disabled.


 

1. Install the mysql server (this is the real database)

Download a MySQL-server-community-5.1.44-1.rhel5.i386.rpm
[Root @ www.linuxidc.com root] # rpm-vihMySQL-server-community-5.1.44-1.rhel5.i386.rpm

 

Install the mysql client (mysql and so on)CommandAnd library files)
Add a virtual account mysql and generate a mysql group at the same time. Note: If the system already exists, you do not need to add it.
[Root @ www.linuxidc.com root] # groupaDdMysql
[Root @ www.linuxidc.com root] #Useradd-G mysql
ExtractShrink mysql Installation File
[Root @ www. linuxidc. comlocal] # tar xvzf mysql-5.0.45-linux-i686.tar.gz
[Root @ www. linuxidc. comlocal] #CdMysql-5.0.45
[Root @ www. linuxidc. comlocal] #./configure -- prefix =/usr/local/mysql

[Root @ www. linuxidc. comlocal] # make

[Root @ www. linuxidc. comlocal] # make install

[Root @ www. linuxidc. comlocal] #Chown-R mysql: mysql/var/lib/mysql
Initialize the mysql database
[Root @ testlocal] #./script/mysql_install_db-user = mysql &
Modify all directory permissions to mysql
[Root @ www. linuxidc. comlocal] # chown-R root.
[Root @ www. linuxidc. comlocal] # chown-R mysql: mysql data
[Root @ www. linuxidc. comlocal] #Chgrp-R mysql.
Note: Set/var/lib/mysql. the sock is linked to the/tmp directory and the name remains unchanged. If this is not done, sometimes an ERROR may be reported during mysql startup, such as ERROR 200: can 'tconnect to local MYSQL server throuht socket/tmp/mysql. sock.
[Root @ www. linuxidc. comlocal] #Ln-S/var/lib/mysql. sock/tmp/
Start mysql Testing
[Root @ www. linuxidc. comlocal] #/usr/local/mysql/bin/safe_mysqld-user = mysql &
Copy a script to compile the directory so that mysql runs automatically every time it starts.
[Root @ www. linuxidc. comlocal] # cpSuPport-files/mysql. server/etc/rc. d/init. d/mysqld
[Root @ www. linuxidc. comlocal] #Chmod700/etc/init. d/mysqld
[Root @ www. linuxidc. comlocal] #Chkconfig-Add mysqld
[Root @ www. linuxidc. comlocal] # chkconfig-level 35 mysqld on
[Root @ www. linuxidc. comlocal] # echo "/usr/local/mysql/lib/mysql">/etc/ls. so. conf
[Root @ www. linuxidc. comlocal] # ldconfig
Note: When/usr/local/mysql/bin/mysqld_safe-user = mysql & command is used to start the mysql test, mysql cannot be started, and you cannot access mysql either, at first, I thought it was my own operation error. Then I decompressed the mysql installation file again and re-installed it. This is still the case and it was very depressing. Finally, I checked the log/var/log/mysqld. log, display:
070829 9:04:08 [ERROR]/usr/local/mysql/bin/mysqld: Can \'t create/WriteTofile \ '/var/run/mysqld. pid \' (Errcode: 13)
070829 9:04:08 [ERROR] Can \ 'tstart server: can \'t create PID file: Permission denied
070829 09:04:08 mysqldended
View the/var/run/mysqld directory according to the log prompt. pid file, view the File Permission of the directory, and find that the user owner does not belong to the root or mysql, and the file owner is 27. It is inferred that mysql may write something into this folder when it is started, but the mysql process user mysql has no permission to write, resulting in mysql being unable to start.Touch/Var/run/mysqld. the pid command creates the mysql file. chown-Rmysql: mysql/var/run/mysqld transfers the directory permissions of/var/run/mysqld to mysql. Use/usr/local/mysql/bin/mysqld_safe-user = mysql & to start mysql again. If no error is reported, run the netatst-tlnup command to check whether mysql port 3306 is enabled, you can see that port 3306 is in the listening status. mysql is started successfully. Use/usr/lcoal/mysql/bin/mysql to enter the mysql database. So far, mysql is successfully installed. This problem is only found in Fedora cora 5. I have not installed mysql in RHEL5.4.


 

2. Install openssl
[Root @ www.linuxidc.com root] # tar zxvf openssl-0.9.8e.tar.gz
[Root @ www.linuxidc.com root] # cd openssl-0.9.8e
[Root @ www. linuxidc. comopenssl-0.9.8e] #./config shared zlib
[Root @ www. linuxidc. comopenssl-0.9.8e] # make
[Root @ www. linuxidc. comopenssl-0.9.8e] # make test
[Root @ www. linuxidc. comopenssl-0.9.8e] # make install
[Root @ www. linuxidc. comopenssl-0.9.8e] #Mv/Usr/bin/openssl. OFF
[Root @ www. linuxidc. comopenssl-0.9.8e] # mv/usr/INcLude/openssl/usr/include/openssl. OFF
[Root @ www. linuxidc. comopenssl-0.9.8e] # rm/usr/lib/libssl. so
[Root @ www. linuxidc. comopenssl-0.9.8e] # ln-s/usr/local/ssl/bin/openssl/usr/bin/openssl
[Root @ www. linuxidc. comopenssl-0.9.8e] # ln-s/usr/local/ssl/include/openssl/usr/include/openssl
[Root @ www. linuxidc. comopenssl-0.9.8e] # ln-sv/usr/local/ssl/lib/libssl. so.0.9.8/usr/lib/libssl. so
Configure the library file search path
[Root @ www. linuxidc. comopenssl-0.9.8e] # echo \ "/usr/local/ssl/lib \">/etc/ld. so. conf
[Root @ www. linuxidc. comopenssl-0.9.8e] # lconfig
Check whether openssl is installed
[Root @ www. linuxidc. comopenssl-0.9.8e] # openssl version
OpenSSL 0.9.8e 23 Feb 2007


 

3. Install cyrus-sasl
[Root @ www.linuxidc.com root] # tar cyrus-sasl-2.1.22.tar.gz
[Root @ www.linuxidc.com root] # cd cyrus-sasl-2.1.22
[Root @ www. linuxidc. coMcYrus-sasl-2.1.22] #./configure -- prefix =/usr/local/sasl2 -- disable-gssapi -- disable-anon -- disable-sample -- disable-digest --Enable-Plain -- enable-login -- enable-SQL -- with-mysql =/usr/local/mysql -- with-mysql-related des =/usr/local/mysql/include/mysql -- -mysql-libs =/usr/local/mysql/lib/mysql -- with-authdaemond =/usr/local/courier-authlib/var/spool/authdaemon/socket

[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # make
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # make install
Disable the original sasl
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # mv/usr/lib/libsasl2.a/usr/lib/libsasl2.a. OFF
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # mv/usr/lib/libsasl2.la/usr/lib/libsasl2.la. OFF (none)
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # mv/usr/lib/libsasl2.so. 2.0.19/usr/lib/libsasl2.so. 2.0.19.OFF
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # mv/usr/lib/sasl2/usr/lib/sasl2.OFF
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # rm/usr/lib/libsasl2.so
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # rm/usr/lib/libsasl2.so. 2
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # ln-s/usr/local/sasl2/lib/*/usr/lib
In Versions later than postfix2.3, sasl library files and header files will be searched in/usr/local/lib and/usr/local/include respectively, so they must be linked to this directory:
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # ln-sv/usr/local/sasl2/lib/*/usr/local/lib
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # ln-sv/usr/local/sasl2/include/sasl/*/usr/local/include
Create the directory required for running and debug and start
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] #Mkdir-Pv/var/state/saslauthd
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] #/usr/local/sasl2/sbin/saslauthd-a shadow pam-d
Start and Test
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] #/usr/local/sasl2/sbin/saslauthd-a shadow pam
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] #
Configure the library file search path
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # echo \ "/usr/local/sasl2/lib \">/etc/ld. so. conf
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # echo \ "/usr/local/sasl2/lib/sasl2 \">/etc/ld. so. conf
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # ldconfig
Automatic startup
[Root @ www. linuxidc. comcyrus-sasl-2.1.22] # echo \ "/usr/local/sasl2/sbin/saslauthd-a shadowpam \">/etc/rc. local

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.