ผลต่างระหว่างรุ่นของ "1. ตั้งค่า hostname CentOS 8"

จาก Wiki_EAI
ไปยังการนำทาง ไปยังการค้นหา
ลไม่มีความย่อการแก้ไข
ลไม่มีความย่อการแก้ไข
 
(ไม่แสดง 8 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
บรรทัดที่ 1: บรรทัดที่ 1:
== ตั้งค่า hostname CentOS 8 ==
1. อัพเดตแพคเกจของ mail serverให้เป็นเวอร์ชั่นล่าสุด ด้วยคำสั่ง
 
1. อัพเดตแพคเกจของ CentOS ให้เป็นเวอร์ชั่นล่าสุด ด้วยคำสั่ง
  '''# yum -y update'''
  '''# yum -y update'''


2. ตั้งค่า hostname
2. กำหนดชื่อ hostname ในตัวอย่างนี้กำหนดชื่อว่า mail.eai.in.th ด้วยคำสั่ง
  '''# hostnamectl set-hostname ''[[mail.eai.in.th]]'''''
  '''# hostnamectl set-hostname ''[[mail.eai.in.th]]'''''


3. เพิ่มชื่อ mail.eai.in.th
3. เพิ่มค่า hostname ชื่อเดียวกับชื่อที่กำหนดข้างต้นในไฟล์ hosts
  '''# vi /etc/hosts'''
  '''# vi /etc/hosts'''


''ตัวอย่างไฟล์ hosts''
  127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4 '''''[[mail.eai.in.th]]'''''
  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]]'''''
  ::1        localhost localhost.localdomain localhost6 localhost6.localdomain6 '''''[[mail.eai.in.th]]'''''


''*ระวัง envelopment ของทาง partner ว่าติดตั้ง centos ในรูปแบบใดมาให้ (อาจจะต้องติดตั้ง service เพิ่ม หากติดตั้งมาแบบ minimal เช่นใช้คำสั่ง vi ไม่ได้)''
''*ระวัง envelopment ของทาง partner ว่าติดตั้ง centos ในรูปแบบใดมาให้ (อาจจะต้องติดตั้ง service เพิ่ม หากติดตั้งมาแบบ minimal เช่นใช้คำสั่ง vi ไม่ได้)''
==  ตั้งค่า firewall CentOS 8
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'''

รุ่นแก้ไขปัจจุบันเมื่อ 15:39, 26 ตุลาคม 2563

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 ไม่ได้)