ผลต่างระหว่างรุ่นของ "3. ติดตั้ง mariadb, postfix, dovecot ของ EAI Email Server บน CentOS 7"
Titipong (คุย | มีส่วนร่วม) (Created page with "1. ติดตั้ง mariadb, postfix, dovecot '''# yum --enablerepo=centosplus install postfix''' '''# yum install dovecot mariadb-server dovecot-mysql''' '''# system...") |
Titipong (คุย | มีส่วนร่วม) ล |
||
แถว 1: | แถว 1: | ||
− | 1. | + | 1. เริ่มติดตั้ง mariadb, postfix, dovecot ด้วยคำสั่ง |
'''# yum --enablerepo=centosplus install postfix''' | '''# yum --enablerepo=centosplus install postfix''' | ||
'''# yum install dovecot mariadb-server dovecot-mysql''' | '''# yum install dovecot mariadb-server dovecot-mysql''' | ||
'''# systemctl enable dovecot''' | '''# systemctl enable dovecot''' | ||
− | 2. remove postfix version 2.x.x ออกก่อน เนื่องจาก postfix version 2.x.x ยังไม่รองรับ EAI ต้องอัพเกรดเป็น version 3.x.x ขึ้นไป | + | 2. ติดตั้ง postfix version 3.x.x |
+ | *remove postfix version 2.x.x ออกก่อน เนื่องจาก postfix version 2.x.x ยังไม่รองรับ EAI ต้องอัพเกรดเป็น version 3.x.x ขึ้นไป | ||
'''# yum remove postfix''' | '''# yum remove postfix''' | ||
'''# yum remove ssmtp''' | '''# yum remove ssmtp''' | ||
แถว 11: | แถว 12: | ||
3. เพิ่ม gf.repo เพื่อติดตั้ง postfix version 3.x.x ขึ้นไป โดยสร้าง repo | 3. เพิ่ม gf.repo เพื่อติดตั้ง postfix version 3.x.x ขึ้นไป โดยสร้าง repo | ||
'''# vi /etc/yum.repos.d/gf.repo''' | '''# vi /etc/yum.repos.d/gf.repo''' | ||
+ | |||
+ | ''ตัวอย่าง'' | ||
'''[gf] | '''[gf] | ||
− | name=Ghettoforge packages that won't overwrite core distro packages. | + | '''name=Ghettoforge packages that won't overwrite core distro packages. |
− | mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist | + | '''mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist |
− | enabled=1 | + | '''enabled=1 |
− | gpgcheck=1 | + | '''gpgcheck=1 |
− | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 | + | '''gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 |
− | failovermethod=priority | + | '''failovermethod=priority |
− | [gf-plus] | + | '''[gf-plus] |
− | name=Ghettoforge packages that will overwrite core distro packages. | + | '''name=Ghettoforge packages that will overwrite core distro packages. |
− | mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist | + | '''mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist |
− | # Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository! | + | '''# Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository! |
− | enabled=1 | + | '''enabled=1 |
− | gpgcheck=1 | + | '''gpgcheck=1 |
− | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7''' | + | '''gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7''' |
− | failovermethod=priority''' | + | '''failovermethod=priority''' |
4. โหลด key ที่ใช้กับ repo วางไว้ใน path : /etc/pki/rpm-gpg/ | 4. โหลด key ที่ใช้กับ repo วางไว้ใน path : /etc/pki/rpm-gpg/ |
รุ่นแก้ไขเมื่อ 20:20, 27 ตุลาคม 2563
1. เริ่มติดตั้ง mariadb, postfix, dovecot ด้วยคำสั่ง
# yum --enablerepo=centosplus install postfix # yum install dovecot mariadb-server dovecot-mysql # systemctl enable dovecot
2. ติดตั้ง postfix version 3.x.x
- remove postfix version 2.x.x ออกก่อน เนื่องจาก postfix version 2.x.x ยังไม่รองรับ EAI ต้องอัพเกรดเป็น version 3.x.x ขึ้นไป
# yum remove postfix # yum remove ssmtp # yum remove sendmail
3. เพิ่ม gf.repo เพื่อติดตั้ง postfix version 3.x.x ขึ้นไป โดยสร้าง repo
# vi /etc/yum.repos.d/gf.repo
ตัวอย่าง
[gf] name=Ghettoforge packages that won't overwrite core distro packages. mirrorlist=http://mirrorlist.ghettoforge.org/el/7/gf/$basearch/mirrorlist enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 failovermethod=priority [gf-plus] name=Ghettoforge packages that will overwrite core distro packages. mirrorlist=http://mirrorlist.ghettoforge.org/el/7/plus/$basearch/mirrorlist # Please read http://ghettoforge.org/index.php/Usage *before* enabling this repository! enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-gf.el7 failovermethod=priority
4. โหลด key ที่ใช้กับ repo วางไว้ใน path : /etc/pki/rpm-gpg/
# cd /etc/pki/rpm-gpg/ # wget http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7
5. ติดตั้ง postfix version 3.x
# yum install postfix3 postfix-mysql # systemctl start postfix # systemctl enable postfix
6. ตั่งค่า MariaDB
# systemctl start mariadb # systemctl enable mariadb
7. ดูสถานะการใช้งานของ MariaDB
# systemctl status mariadb
8. ตั้งค่า UTF8 ให้กับ mysql เพื่อให้รองรับภาษาไทย โดยเพิ่มคำสั่งด้าล่างลงใน /etc/my.cnf ใต้ [mysqld]
# vi /etc/my.cnf
[mysqld] character-set-server = utf8 collation-server = utf8_general_ci skip-character-set-client-handshake bind-address=127.0.0.1 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d
9. สั่ง restart mariadb
# systemctl restart mariadb
10. ตั้งค่าความปลอดภัยการเข้างาน mysql โดยจะมีการตั้ง password ของ root user เพื่อ login เข้าใช้งาน (*กำหนดเพียง password ใหม่ และในส่วนอื่นๆให้ enter ผ่านได้เลย)
# mysql_secure_installation
11. Login ข้าใช้งาน mysql โดยใช้ password ของ root user ที่ได้ตั้งไว้
# mysql -u root -p
12. สร้าง DB เพื่อใช้งานการเก็บข้อมูลของการใช้งาน Email Server
# CREATE DATABASE eaimail; # USE eaimail;
13. สร้าง user พร้อมกำหนดสิทธิ์การใช้งานให้กับ eaimail db
# GRANT SELECT, INSERT, UPDATE, DELETE ON eaimail.* TO 'yourdbuser'@'localhost' IDENTIFIED BY 'yourdbpassword'; # GRANT SELECT, INSERT, UPDATE, DELETE ON eaimail.* TO 'yourdbuser'@'localhost.localdomain' IDENTIFIED BY 'yourdbpassword'; # FLUSH PRIVILEGES;
14. ตรวจสอบ userที่สร้างขึ้นใหม่โดย
# SHOW GRANTS FOR 'yourdbuser'@'localhost';
15. สร้างตารางใช้เก็บค่า Domain
# CREATE TABLE domains (domain varchar(50) NOT NULL, PRIMARY KEY (domain) );'
16. สร้างตารางใช้สำหรับ forward mail
# CREATE TABLE forwardings (source varchar(80) NOT NULL, destination TEXT NOT NULL, PRIMARY KEY (source) );
17. สร้างตาราง user เพื่อใช้สร้าง mailbox และออกจาก mysql
# CREATE TABLE users (email varchar(80) NOT NULL, password varchar(20) NOT NULL, PRIMARY KEY (email) ); # quit
18. สั่ง restart mariadb
# systemctl restart mariadb.service