1. ตั้งค่า Host ให้พร้อมใช้งาน

จาก Wiki_EAI
ไปยังการนำทาง ไปยังการค้นหา

1. อัพเดตแพคเกจของ CentOS ให้เป็นเวอร์ชั่นล่าสุด ด้วยคำสั่ง

# yum -y update

2. ตั้งค่า hostname

# hostnamectl set-hostname mail.eai.in.th

3. เพิ่มชื่อ mail.eai.in.th

# vi /etc/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. ทำการตั้งค่าเปิด firewall

  • ตรวจสอบสถานะของ firewall โดยต้องได้สถานะ Active (running)
# systemctl status firewalld
  • ตรวจสอบ Zone และ Interface ของ Network ที่ใช้อยู่ปัจจุบัน
# firewall-cmd --get-active-zones
public
interfaces: ens32
  • ตรวจสอบ service ที่ firewall เปิดให้ใช้งาน
# firewall-cmd --zone=public --list-services
cockpit dhcpv6-client ssh
  • เพิ่ม service ของ mail server ที่เราจะต้องใช้
# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --permanent --zone=public --add-service=mysql
# firewall-cmd --permanent --zone=public --add-service=smtp
# firewall-cmd --permanent --zone=public --add-service=smtps
# firewall-cmd --permanent --zone=public --add-service=imap
# firewall-cmd --permanent --zone=public --add-service=imaps
# firewall-cmd --reload
  • ตรวจสอบ service ของ firewall ที่เปิดเพิ่ม
# firewall-cmd --zone=public --list-services
cockpit dhcpv6-client http https imap imaps mysql smtp smtps ssh

*add firewall service for mail server (https://spalinux.com/2015/06/centos-7-basic-configure-firewall-by-firewall-cmd)


5. ปิด selinux (เพื่อสะดวกต่อการ configure แต่ความปลอดภัยจะลดลง)

  • เปลี่ยน 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
  • Restart ระบบ และทำการตรวจสอบ
# reboot
  • ตรวจสอบสถานะของ SELinux
# sestatus
disabled


6. ติดตั้ง wget เพื่อใช้ download service ที่จำเป็นต้องใช้งานเพิ่ม

# yum install wget