ผลต่างระหว่างรุ่นของ "คู่มือการพัฒนา EAI Mail Server บน CentOS 8"
ไม่มีความย่อการแก้ไข |
Photchanan (คุย | ส่วนร่วม) ไม่มีความย่อการแก้ไข |
||
| บรรทัดที่ 56: | บรรทัดที่ 56: | ||
[[Category: EAI]] | [[Category: EAI]] | ||
=== ตั้งค่า hostname === | |||
1. อัพเดตแพคเกจของ mail serverให้เป็นเวอร์ชั่นล่าสุด ด้วยคำสั่ง | |||
'''# yum -y update''' | |||
2. กำหนดชื่อ hostname ในตัวอย่างนี้กำหนดชื่อว่า mail.eai.in.th ด้วยคำสั่ง | |||
'''# hostnamectl set-hostname ''[[mail.eai.in.th]]''''' | |||
3. เพิ่มค่า hostname ชื่อเดียวกับชื่อที่กำหนดข้างต้นในไฟล์ hosts | |||
'''# vi /etc/hosts''' | |||
''ตัวอย่างไฟล์ hosts'' | |||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 '''''[[mail.eai.in.th]]''''' | |||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 '''''[[mail.eai.in.th]]''''' | |||
''*ระวัง envelopment ของทาง partner ว่าติดตั้ง centos ในรูปแบบใดมาให้ (อาจจะต้องติดตั้ง service เพิ่ม หากติดตั้งมาแบบ minimal เช่นใช้คำสั่ง vi ไม่ได้)'' | |||
4. ติดตั้ง wget เพื่อใช้ดาวน์โหลดซอฟแวร์ที่จำเป็นต้องใช้งานเพิ่ม | |||
'''# yum -y install wget''' | |||
5. ติดตั้ง telnet เพื่อทดสอบการทำงานของ email server | |||
'''# yum -y install telnet''' | |||
=== ตั้งค่า firewall === | |||
1. ตรวจสอบสถานะ firewalld service บน mail server | |||
*ต้องมีสถานะ active (running) | |||
'''# systemctl status firewalld''' | |||
''ตัวอย่าง'' | |||
'''Active: <span style='color:red'>active (running)</span> since Mon 2019-11-18 14:12:03 +07; 1h 13min ago''' | |||
2. ตรวจสอบ firewall zone และ network interface ที่เปิดอยู่ | |||
'''# firewall-cmd --get-active-zones''' | |||
''ตัวอย่าง'' | |||
'''public | |||
'''interfaces: ens32 | |||
3. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public | |||
'''# firewall-cmd --zone=public --list-services''' | |||
''ตัวอย่าง'' | |||
''' cockpit dhcpv6-client ssh ''' | |||
4. เปิด firewall services ที่ zone public ของ mail server (สามารถเปิดเท่าต้องการได้) | |||
'''# firewall-cmd --permanent --zone=public --add-service={http,https,mysql,smtp,smtps,imap,imaps} | |||
'''# firewall-cmd --reload | |||
5. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public อีกครั้ง จะพบ services เปิดเพิ่มขึ้นมา | |||
''*ref: configure firewall services for mail server (https://spalinux.com/2015/06/centos-7-basic-configure-firewall-by-firewall-cmd)'' | |||
'''# firewall-cmd --zone=public --list-services''' | |||
''ตัวอย่าง'' | |||
''' cockpit dhcpv6-client <span style='color:red'>http https imap imaps mysql smtp smtps</span> ssh ''' | |||
6. ในตัวอย่างนี้เราแนะนำให้ปิดการทำงานของ SELinux เพื่อความสะดวกในการตั้งค่า (ไม่แนะนำให้ทำกับเครื่อง production) | |||
*เปลี่ยน SELinux=enforcing เป็น SELinux=disabled | |||
'''# vi /etc/selinux/config''' | |||
''ตัวอย่าง'' | |||
'''# This file controls the state of SELinux on the system. | |||
'''# SELINUX= can take one of these three values: | |||
'''# enforcing - SELinux security policy is enforced. | |||
'''# permissive - SELinux prints warnings instead of enforcing. | |||
'''# disabled - No SELinux policy is loaded. | |||
'''SELINUX=<span style='color:red'>disabled</span> | |||
'''# SELINUXTYPE= can take one of these two values: | |||
'''# targeted - Targeted processes are protected, | |||
'''# mls - Multi Level Security protection. | |||
'''SELINUXTYPE=targeted | |||
7. ตรวจสอบสถานะ SELinux อีกครั้ง | |||
* สั่ง restart server และทำการตรวจสอบ | |||
'''# reboot''' | |||
'''# sestatus''' | |||
''ตัวอย่าง'' | |||
''' disabled ''' | |||
รุ่นแก้ไขเมื่อ 09:23, 29 มิถุนายน 2564
EAI Email Server
คู่มือนี้ได้จัดทำขึ้นมาเพื่อทดสอบและเป็นแนวทางการติดตั้ง Email Server ในรูปแบบรองรับภาษาไทย (EAI) โดยใช้ Software Opensource ในการทดสอบเพื่อหาวิธีการที่สามารถใช้งานได้ และสามารถนำไปพัฒนาต่อยอดได้ ซึ่งค่า configure ที่ผู้จัดทำใช้นั้น
Software ที่นำมาทดสอบ:
- CentOS8 for Virtualbox [CentOS for VirtualBox]
- user: root
- pass: rooteai
- VirtualBox [Win] [Mac]
- VirtualBox Extension Pack [ดาวน์โหลด]
- Filezilla [Win] [Mac]
- putty [Win] (เฉพาะเครื่อง windows)
- Postfix 3.x [ดาวน์โหลด]
- Dovecot 2.x [ดาวน์โหลด]
- MariaDB 10.x [ดาวน์โหลด]
- Roundcube 1.4.x [ดาวน์โหลด] [tar]
- ข้อ 1, 2, 3, 4, 5 แนะนำให้ติดตั้งเตรียมไว้ก่อนอบรม
ขั้นตอนการติดตั้ง CentOS8 for Virtualbox
- ดาวน์โหลดและติดตั้ง VirtualBox และ VirtualBox Extension Pack
- ดาวน์โหลดไฟล์ CentOS8 for Virtualbox (centos-eai-wokshop.ova) ที่จัดเตรียมไว้ให้ตามลิงค์ด้านบน
- ดับเบิ้ลคลิ๊กที่ไฟล์ centos-eai-wokshop.ova เพื่อ import เข้าโปรแกรม Virtualbox [1]
- หลังจาก import เสร็จเรียบร้อยแล้ว ที่โปรแกรม VirtualBox ให้ดับเบิ้ลคลิ๊กที่ centos-eai-wokshop ด้านซ้ายมือ เพื่อเปิด server
- ถ้าพบข้อผิดพลาด "ไม่สามารถเริ่มการทำงานเครื่อง centos-eai-workshop เนื่องจากไม่พบแผงวงจรเครือข่าย"
- ให้กด "เปลี่ยนการติดตั้งเครือข่าย" จะขึ้นหน้าเปลี่ยนเครือข่าย ให้กด "ตกลง" [2]
- เมื่อเปิดเครื่องได้แล้ว ให้ login ด้วย user, pass ที่เตรียมไว้ให้ข้างต้น และใช้คำสั่ง "ifconfig" เพื่อตรวจสอบ IP ของเครื่อง [3]
- ให้จด IP นี้ไว้ใช้สำหรับ ssh เข้าเครื่อง Server ของเราในการทำงาน workshop (*แต่ละเครื่องจะได้ IP แตกต่างกัน)
(สำหรับเครื่อง mac ต้อง allow ให้ virtualbox ทำงานได้ตามนี้ [4])
หมายเหตุ
- คู่มือนี้ไม่ได้อธิบายถึงการติดตั้ง Centos 8
- Postfix ต้องเป็น Version 3.x.x ขึ้นไป จะรองรับ EAI
- หากจะนำไปใช้งานจริงจะต้องจดทะเบียนโดเมน และมี dns server ด้วย
การติดตั้ง EAI Email Server
ตั้งค่า hostname
1. อัพเดตแพคเกจของ mail serverให้เป็นเวอร์ชั่นล่าสุด ด้วยคำสั่ง
# yum -y update
2. กำหนดชื่อ hostname ในตัวอย่างนี้กำหนดชื่อว่า mail.eai.in.th ด้วยคำสั่ง
# hostnamectl set-hostname mail.eai.in.th
3. เพิ่มค่า hostname ชื่อเดียวกับชื่อที่กำหนดข้างต้นในไฟล์ hosts
# vi /etc/hosts
ตัวอย่างไฟล์ hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 mail.eai.in.th ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 mail.eai.in.th
*ระวัง envelopment ของทาง partner ว่าติดตั้ง centos ในรูปแบบใดมาให้ (อาจจะต้องติดตั้ง service เพิ่ม หากติดตั้งมาแบบ minimal เช่นใช้คำสั่ง vi ไม่ได้)
4. ติดตั้ง wget เพื่อใช้ดาวน์โหลดซอฟแวร์ที่จำเป็นต้องใช้งานเพิ่ม
# yum -y install wget
5. ติดตั้ง telnet เพื่อทดสอบการทำงานของ email server
# yum -y install telnet
ตั้งค่า firewall
1. ตรวจสอบสถานะ firewalld service บน mail server
- ต้องมีสถานะ active (running)
# systemctl status firewalld
ตัวอย่าง
Active: active (running) since Mon 2019-11-18 14:12:03 +07; 1h 13min ago
2. ตรวจสอบ firewall zone และ network interface ที่เปิดอยู่
# firewall-cmd --get-active-zones
ตัวอย่าง
public interfaces: ens32
3. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public
# firewall-cmd --zone=public --list-services
ตัวอย่าง
cockpit dhcpv6-client ssh
4. เปิด firewall services ที่ zone public ของ mail server (สามารถเปิดเท่าต้องการได้)
# firewall-cmd --permanent --zone=public --add-service={http,https,mysql,smtp,smtps,imap,imaps}
# firewall-cmd --reload
5. ตรวจสอบรายการ services ของ firewall ที่เปิดอยู่ที่ zone public อีกครั้ง จะพบ services เปิดเพิ่มขึ้นมา
*ref: configure firewall services for mail server (https://spalinux.com/2015/06/centos-7-basic-configure-firewall-by-firewall-cmd)
# firewall-cmd --zone=public --list-services
ตัวอย่าง
cockpit dhcpv6-client http https imap imaps mysql smtp smtps ssh
6. ในตัวอย่างนี้เราแนะนำให้ปิดการทำงานของ SELinux เพื่อความสะดวกในการตั้งค่า (ไม่แนะนำให้ทำกับเครื่อง production)
- เปลี่ยน SELinux=enforcing เป็น SELinux=disabled
# vi /etc/selinux/config
ตัวอย่าง
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
7. ตรวจสอบสถานะ SELinux อีกครั้ง
- สั่ง restart server และทำการตรวจสอบ
# reboot # sestatus
ตัวอย่าง
disabled