<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="th">
	<id>https://wiki.thnic.or.th/index.php?action=history&amp;feed=atom&amp;title=Centos_-_base_installation</id>
	<title>Centos - base installation - ประวัติรุ่นแก้ไข</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.thnic.or.th/index.php?action=history&amp;feed=atom&amp;title=Centos_-_base_installation"/>
	<link rel="alternate" type="text/html" href="https://wiki.thnic.or.th/index.php?title=Centos_-_base_installation&amp;action=history"/>
	<updated>2026-10-23T05:23:15Z</updated>
	<subtitle>ประวัติรุ่นแก้ไขของหน้านี้ในวิกิ</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.thnic.or.th/index.php?title=Centos_-_base_installation&amp;diff=114&amp;oldid=prev</id>
		<title>Titipong: Created page with &quot;&#039;&#039;&#039;Installing Postfix with SMTPUTF8 enabled, Cyrus SASL and OpenSSL&#039;&#039;&#039;  == Summary of  the mail server == This guide will install a Mail server that can receive mail with SMTP...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.thnic.or.th/index.php?title=Centos_-_base_installation&amp;diff=114&amp;oldid=prev"/>
		<updated>2019-09-30T09:20:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Installing Postfix with SMTPUTF8 enabled, Cyrus SASL and OpenSSL&amp;#039;&amp;#039;&amp;#039;  == Summary of  the mail server == This guide will install a Mail server that can receive mail with SMTP...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;หน้าใหม่&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Installing Postfix with SMTPUTF8 enabled, Cyrus SASL and OpenSSL&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Summary of  the mail server ==&lt;br /&gt;
This guide will install a Mail server that can receive mail with SMTPUTF8 . This prevents the senders  email to bounce &lt;br /&gt;
when the mail server does not support SMTPUTF8.&lt;br /&gt;
&lt;br /&gt;
This includes Imap and POP3 using Courier, the users will be added as local user, with or without SSH login . They have&lt;br /&gt;
their mail stored in /home/user.&lt;br /&gt;
&lt;br /&gt;
A modified Squirrel-mail is installed to send and receive  email?? (NEED TO TEST THIS )&lt;br /&gt;
&lt;br /&gt;
Any email client can be used as your user is not an EAI address.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using Centos 7, 64 Bit&lt;br /&gt;
&lt;br /&gt;
* Not tested on Centos 5 and 6 and it may not work.&lt;br /&gt;
&lt;br /&gt;
You can install this as root otherwise if specified to use a non privileged user.&lt;br /&gt;
&lt;br /&gt;
== Notice, requirements and initial setup ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Centos 7 64 bit, with minimal installation &lt;br /&gt;
* Centos 7 comes with postfix 2.x already installed&lt;br /&gt;
* The guide assume you are using root, unless otherwise stated.&lt;br /&gt;
* You already setup your DNS settings&lt;br /&gt;
* hostname is the name your domain e.g ( domain.com )&lt;br /&gt;
* mail.hostname is the name of your Mail server e.g (mail.domain.com)&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;&amp;#039;Update your hostname &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;#039;&amp;#039;If you are using an internional domain, use the punycode equivalent.&lt;br /&gt;
&lt;br /&gt;
For example mail.วีคลาส.ไทย should be punycode equivalent mail.xn--42c0eeo3bp.xn--o3cw4h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/hostname&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
UPDATE YOUR OWN hostname for your Mail server&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mail.domain.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reboot your server to update your hostname. &lt;br /&gt;
&lt;br /&gt;
After reboot, the following command should show your hostname mail.domain.com&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
hostname&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Postfix from source and required libraries (Cyrus  SASL, OPENSSL)  ==&lt;br /&gt;
&lt;br /&gt;
Get Postfix version 3.0.1 or later versions to enable SMTPUTF8 extension.  You can get a copy in &lt;br /&gt;
http://www.postfix.org/download.html. In the example below we have downloaded postfix-3.0.1.tar.gz, your version might be different. Currently, installing Postfix by apt-get will install an older version that has no support yet for SMTPUTF8. This may also change in the future.  &lt;br /&gt;
&lt;br /&gt;
Install the required libraries and tools&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
yum groupinstall development tools&lt;br /&gt;
yum install cyrus-sasl cyrus-sasl-devel openssl openssl-devel libdb-devel.x86_64 libicu-devel telnet net-tools&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download Postfix 3.0.1 or later version&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar -xzvf postfix-3.0.1.tar.gz&lt;br /&gt;
cd postfix-3.0.1&lt;br /&gt;
sed -i &amp;#039;s/.\x08//g&amp;#039; README_FILES/*&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Compile with openssl and sasl auth &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
make makefiles CCARGS=&amp;#039;-DUSE_TLS -I/usr/include/openssl  -DUSE_SASL_AUTH -DUSE_CYRUS_SASL  -I/usr/include/sasl &amp;#039;   AUXLIBS=&amp;#039;-L/usr/lib64  -L/usr/lib64/openssl -L/usr/lib64/sasl2 -lssl -lcrypto -lsasl2&amp;#039;&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note: If you are using a 32Bit OS, replace the modify the /lib64 to /lib&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Finaly install Postfix &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
make upgrade&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
you can remove the config files that are not used anymore, which is shown after the last part of the installation.&lt;br /&gt;
&lt;br /&gt;
== Postfix configuration ==&lt;br /&gt;
&lt;br /&gt;
Create Alias for mails for root or postmaster will be sent to a real user (YourLogin). Optional: Centos 7 , already filled this up&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi /etc/aliases&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy and paste the code below, change YourLogin to your own user then save and quit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
MAILER-DAEMON:    postmaster&lt;br /&gt;
postmaster:       root&lt;br /&gt;
root:             YourLogin&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
newaliases&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change mail.domain.tld, domain.tld,  yourotherdomain.tld(or remove this)&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;vim&amp;quot;&amp;gt;&lt;br /&gt;
postconf compatibility_level=2&lt;br /&gt;
postconf -e &amp;#039;myhostname  = mail.domain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mydomain    = domain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;myorigin    = $mydomain&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;inet_interfaces = all&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;alias_database = hash:/etc/aliases&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;alias_maps = hash:/etc/aliases&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yourotherdomain.tld&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtputf8_enable = yes&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Finally start Postfix for the first time&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
service postfix restart&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Try and Send a Mail using Telnet and send mail to an external server like gmail&lt;br /&gt;
&lt;br /&gt;
== Test if you have SMTPUTF8 enabled ==&lt;br /&gt;
&lt;br /&gt;
Enter the command in  the console, this will connect to the SMTP &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 telnet localhost 25&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should result to&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Trying 127.0.0.1...&lt;br /&gt;
Connected to localhost.&lt;br /&gt;
Escape character is &amp;#039;^]&amp;#039;.&lt;br /&gt;
220 YourHostName ESMTP Postfix&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type the following and press enter&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EHLO localhost&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you can see &amp;#039;&amp;#039;&amp;#039;250 SMTPUTF8&amp;#039;&amp;#039;&amp;#039; then your server should be able to send and received from an internationalized email addresses&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
250-YourHostName&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-SIZE 10240000&lt;br /&gt;
250-VRFY&lt;br /&gt;
250-ETRN&lt;br /&gt;
250-ENHANCEDSTATUSCODES&lt;br /&gt;
250-8BITMIME&lt;br /&gt;
250-DSN&lt;br /&gt;
250 SMTPUTF8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t see the 250 SMTPUTF8, try removing Postfix and try again. You may have installed a component that installed an older Postfix.&lt;br /&gt;
&lt;br /&gt;
== Enable SMTP Auth ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
yum install  cyrus-sasl-plain&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;vi /etc/sasl2/smtpd.conf&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pwcheck_method: saslauthd&lt;br /&gt;
mech_list: PLAIN LOGIN&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Update Postfix config&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_path = smtpd&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_auth_enable = yes&amp;#039;&lt;br /&gt;
service saslauthd start&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a user which we can test for authentication, replace AnyUserName with your own.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
useradd -m AnyUserName  -s /usr/sbin/nologin&lt;br /&gt;
passwd AnyUserName &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generate your Auth key, replace username with your username and password with your password&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
perl -MMIME::Base64 -e &amp;#039;print encode_base64(&amp;quot;username\0username\0password&amp;quot;);&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace dGVzdAB0ZXN0AHRlc3Q= , with the one you generated&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
telnet 	localhost 25&lt;br /&gt;
EHLO localhost&lt;br /&gt;
AUTH PLAIN dGVzdAB0ZXN0AHRlc3Q=	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should get a message Authentication successful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finalize Postfix config to allow only authenticated users to send SMTP&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;broken_sasl_auth_clients = yes&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_security_options = noanonymous&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_sasl_local_domain = $mydomain&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_relay_restrictions =  permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_sender_login_mismatch&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enable TLS ==&lt;br /&gt;
&lt;br /&gt;
Create the certificates&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /etc/postfix&lt;br /&gt;
&lt;br /&gt;
openssl req -new -outform PEM -out smtpd.cert \&lt;br /&gt;
   -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM \&lt;br /&gt;
   -days 365 -x509&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Answer the following questions as prompted&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Update Postfix config&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;smtpd_enforce_tls = no&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_security_level = may&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_loglevel = 1&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_use_tls = yes&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_key_file  = /etc/postfix/smtpd.key&amp;#039;&lt;br /&gt;
postconf -e &amp;#039;smtpd_tls_cert_file  = /etc/postfix/smtpd.cert&amp;#039;&lt;br /&gt;
service postfix restart&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can test by &amp;#039;&amp;#039;telnet localhost 25&amp;#039;&amp;#039; and doing an &amp;#039;&amp;#039;EHLO localhost&amp;#039;&amp;#039;, you should see &amp;#039;&amp;#039;&amp;#039;STARTTLS&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
250-PIPELINING&lt;br /&gt;
250-SIZE 10240000&lt;br /&gt;
250-VRFY&lt;br /&gt;
250-ETRN&lt;br /&gt;
250-STARTTLS&lt;br /&gt;
250-AUTH PLAIN LOGIN&lt;br /&gt;
250-AUTH=PLAIN LOGIN&lt;br /&gt;
250-ENHANCEDSTATUSCODES&lt;br /&gt;
250-8BITMIME&lt;br /&gt;
250-DSN&lt;br /&gt;
250 SMTPUTF8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Issue the command&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
STARTTLS&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and you should see the result&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
220 2.0.0 Ready to start TLS&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sending and Receiving email to and from the Internet ==&lt;br /&gt;
&lt;br /&gt;
*Note, installing a command line mail may overwrite your Postfix to an older version.&lt;br /&gt;
&lt;br /&gt;
Sending email by telnet&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
telnet localhost 25&lt;br /&gt;
EHLO localhost&lt;br /&gt;
&lt;br /&gt;
MAIL FROM: &amp;lt;youruser@domain.tld&amp;gt; SMTPUTF8&lt;br /&gt;
RCPT TO: &amp;lt;EAI@IDN.idn&amp;gt;&lt;br /&gt;
data&lt;br /&gt;
Subject: A Test&lt;br /&gt;
&lt;br /&gt;
This is the body&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take not of the dot(.) , this is to end and send the message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this point make sure you can send and receive mail.&lt;br /&gt;
&lt;br /&gt;
You can send message using an EAI address and check /var/log/maillog, in the log below test@domain.tld is a local receiver&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Aug  3 02:48:49 ip-172-31-21-209 postfix/local[21614]: 7EAD343550: to=&amp;lt;test@domain.tld&amp;gt;, relay=local, delay=0.62, delays=0.62/0/0/0, dsn=2.0.0, status=sent (delivered to mailbox)&lt;br /&gt;
Aug  3 02:48:49 ip-172-31-21-209 postfix/qmgr[21586]: 7EAD343550: removed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The email stored is stored in /var/mail/&lt;br /&gt;
&lt;br /&gt;
if you cannot receive any email, use an online tool such as mxtoolbox.com to diagnose your problem.&lt;br /&gt;
&lt;br /&gt;
== Configuring Courier authlib, Courier imap==&lt;br /&gt;
This will enable imap and pop3 &lt;br /&gt;
&lt;br /&gt;
Install libtool which is a requirement for authlib, &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
yum install libtool-ltdl-devel.x86_64&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install Courier Unicode Library 1.2 which can be downloaded in http://sourceforge.net/projects/courier/files/courier-unicode &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar -jxvf courier-unicode-1.2.tar.bz2&lt;br /&gt;
cd courier-unicode-1.2&lt;br /&gt;
./configure&lt;br /&gt;
make &lt;br /&gt;
make install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download authlib http://sourceforge.net/projects/courier/files/authlib/ , the latest version was 0.66.3 &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar -jxvf courier-authlib-0.66.3.tar.bz2&lt;br /&gt;
cd courier-authlib-0.66.3&lt;br /&gt;
./configure --with-authshadow --with-mailuser=postfix --with-mailgroup=postfix&lt;br /&gt;
make &lt;br /&gt;
make install&lt;br /&gt;
make install-configure&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;vi /usr/local/etc/authlib/authdaemonrc&amp;#039;&amp;#039; and change the authentication method&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
authmodulelist=&amp;quot;authshadow&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;vi /etc/ld.so.conf.d/locallibs.conf&amp;#039;&amp;#039; and add&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/local/lib&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Apply the changes..&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ldconfig&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then Start&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/local/sbin/authdaemond  start&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if it is running&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ps -ef |grep authdaemond&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It should show the following&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 26393 26392  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
 26394 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
 26395 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
 26396 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
 26397 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
 26398 26393  0 10:26 ?        00:00:00 /usr/local/libexec/courier-authlib/authdaemond&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: &amp;#039;&amp;#039;&amp;#039;You must change to a normal user(Not root)&amp;#039;&amp;#039;&amp;#039; (Create a new user first, if you don&amp;#039;t have any)&lt;br /&gt;
&lt;br /&gt;
Install courier imap which will support both Imap and Pop3&lt;br /&gt;
&lt;br /&gt;
Download from http://sourceforge.net/projects/courier/files/imap&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
tar -jxvf courier-imap-4.16.2.tar.bz2&lt;br /&gt;
cd courier-imap-4.16.2&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can go back as root here, if you don&amp;#039;t want to use sudo&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo make install&lt;br /&gt;
sudo make install-configure&lt;br /&gt;
cd /usr/lib/courier-imap/libexec&lt;br /&gt;
./pop3d.rc start&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check if imap is running&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
netstat -ntlp | grep 110&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Enabling SSL using self signed certificate&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /usr/lib/courier-imap/etc&lt;br /&gt;
vi pop3d.cnf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modify as needed, then save and quit&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;vim&amp;quot;&amp;gt;&lt;br /&gt;
[ req_dn ]&lt;br /&gt;
C=US&lt;br /&gt;
ST=NY&lt;br /&gt;
L=New York&lt;br /&gt;
O=Courier Mail Server&lt;br /&gt;
OU=Automatically-generated POP3 SSL key&lt;br /&gt;
CN=localhost&lt;br /&gt;
emailAddress=postmaster@example.com&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now generate the certificates&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 cd ../share&lt;br /&gt;
 ./mkpop3dcert&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now run pop with ssl and will listen at port 995&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd /usr/lib/courier-imap/libexec&lt;br /&gt;
./pop3d-ssl.rc start&lt;br /&gt;
netstat -tulpn |grep 995&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally enable pop3 and pop3s at init&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
@TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue with Imap&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/lib/courier-imap/libexec/imapd.rc start&lt;br /&gt;
netstat -ntlp | grep 143&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;vi /usr/lib/courier-imap/etc/imapd&amp;#039;&amp;#039; Change &amp;#039;&amp;#039;&amp;#039;IMAPDSTART=NO&amp;#039;&amp;#039;&amp;#039;   to&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;vim&amp;quot;&amp;gt;&lt;br /&gt;
IMAPDSTART=yes&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Enable Imap SSL by using self generated certificates&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;vi /usr/lib/courier-imap/etc/imapd.cnf&amp;#039;&amp;#039;  and edit the values accordingly, then generate the certs.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;vim&amp;quot;&amp;gt;&lt;br /&gt;
 /usr/lib/courier-imap/share/mkimapdcert&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now start and check imap-ssl &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
/usr/lib/courier-imap/libexec/imapd-ssl.rc start&lt;br /&gt;
netstat -ntlp |grep 993&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally enable at startup&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
@TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configure Postfix to use Maildir as a storage for Mail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
postconf -e &amp;#039;home_mailbox = Maildir/&amp;#039;&lt;br /&gt;
postfix reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update the Skeleton and create the folder for user we created just before. In this example we used the user test&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p /etc/skel/Maildir/{cur,new,tmp}&lt;br /&gt;
&lt;br /&gt;
mkdir -p /home/test/Maildir/{cur,new,tmp}&lt;br /&gt;
chown test.test /home/test/Maildir/{,cur,new,tmp}&lt;br /&gt;
chmod 0700 /home/test/Maildir/{,cur,new,tmp}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test imap, pop3 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
telnet localhost imap&lt;br /&gt;
ok login username password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
telnet localhost pop3&lt;br /&gt;
User username&lt;br /&gt;
Pass password&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Open Firewall ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
firewall-cmd --zone=public --add-port=995/tcp --permanent&lt;br /&gt;
firewall-cmd --zone=public --add-port=110/tcp --permanent&lt;br /&gt;
firewall-cmd --zone=public --add-port=143/tcp --permanent&lt;br /&gt;
firewall-cmd --zone=public --add-port=25/tcp --permanent&lt;br /&gt;
firewall-cmd --reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install Squirrel-mail ==&lt;br /&gt;
&lt;br /&gt;
 Make sure you have apache and php installed.&lt;br /&gt;
&lt;br /&gt;
Install Modified Squirrel mail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd to-your-public-html-folder&lt;br /&gt;
wget http://interlab.ait.ac.th/eai-wiki/files/squirrelmail.zip&lt;br /&gt;
unzip squirrelmail.zip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
edit the configuration file and change the &amp;#039;&amp;#039;&amp;#039;attachchment_dir&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;data_dir&amp;#039;&amp;#039;&amp;#039;, don&amp;#039;t forget to create the folders.&lt;br /&gt;
Change the ownership to your &amp;#039;&amp;#039;&amp;#039;apache user&amp;#039;&amp;#039;&amp;#039;, and allow a write access as well.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
vi squirrelmail/config/config.php &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Access squirrelmail&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
http://your-domain/squirrelmail/&lt;br /&gt;
&amp;lt;/syntaxhighlight &amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
Mail server is not sending or receiving email to outside world&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
&lt;br /&gt;
http://postfix.org/&lt;/div&gt;</summary>
		<author><name>Titipong</name></author>
	</entry>
</feed>