เอกสาร: Linux VPS Datasheet อัพเดทล่าสุด : 11/11/2020 ภาษา: ไทย รูปแบบ: PDF Format (2 หน้า) ข้อมูลเกี่ยวกับเอกสาร: สำหรับผู้สนใจทั่วไปและผู้ประกอบการ เกี่ยวกับฟีเจอร์, ฟังก์ชั่นการทำงานและราคาของแพลนต่างๆ ของ Linux VPS เพื่อประกอบการตัดสินใจได้ง่ายขึ้น
การเขียน Script Backup postgresql 1. รันคำสั่ง su - postgres (เพื่อเข้าใช้งาน user : postgres) 2. รันคำสั่ง psql (เพื่อเข้าตรวจสอบ database) 3. รันคำสั่ง \l (เพื่อเข้าดูรายชื่อ database) 4. ดำเนินการเชียนไฟล์ script : backupOdoo.sh ที่ path : /var/lib/postgresql #!/bin/bash #################################### # Backup to NFS mount script. #################################### # Create Folder date. mkdir /var/lib/postgresql/9.6/main/backup_Odoo/$(date +%d-%m-%Y_%H00); # Dump database time. pg_dump -d Database name -f /path ที่ต้องการเก็บไฟล์ Database/ชื่อไฟล์ Database.pgsql; #Remove database 7 day find /var/lib/postgresql/9.6/main/backup_Odoo/ -type f -mtime +7 -exec rm -f {} \; 4. เขียนไฟล์ cronjob : postgres ที่ path : /var/spool/cron/crontabs (เพื่อรันไฟล์ Script ตามที่กำหนดไว้) # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.9OXrVx/crontab installed on Fri Jul 10 17:14:55 2020) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command * * * * * /bin/sh /var/lib/postgresql/backupOdoo.sh
ในส่วนของขั้นตอนการตั้งค่าต่อไปนี้ จะเป็นการตั้งค่าต่างเกี่ยวกับ Server โดยจะนำมาเฉพาะ เมนูที่จำเป็นต่อการใช้งานและความเหมาะสมกับและง่ายการดูแล Server ให้มีประสิทธิภาพ และปลอดภัย ข้อมูลส่วนใหญ่จะเป็นการอ้างอิงจากค่าที่ใช้งานจริง ซึ่งสำหรับผู้ดูแล Server แล้ว ควรจะต้องปรับตามความเหมาะสมของการใช้งานเป็นหลัก Step 0: Check Information for Access WHM เตรียมข้อมูล Username Password สำหรับเข้าใช้งาน WHM ทดสอบ Login เข้าใช้งาน WHM ผ่าน URL https://your-ip-server:2087 หรือ 2086 Step 1: Create a New cPanel Account หากมีการสร้าง cPanel Account ไว้อยู่แล้ว สามารถข้ามขั้นตอนนี้ไปได้เลย ** หากยังไม่มีการสร้าง cPanel Account มาก่อนนั้นสามารถทำการสร้างได้ตามขั้นตอนนี้ ** >> Create a New cPanel Account By WHM << Step 2: Basic WebHost Manager® Setup Home »Server Configuration »Basic WebHost Manager® Setup 1.Contact Information: จะใช้ข้อมูลในส่วนนี้เป็นการแจ้งเตือนหรือแจ้งปัญหาต่างๆที่เกิดบน Server ในส่วนนี้แนะนำให้ใส่เป็นอีเมล์ของผู้ดูแล Server ที่สามารถรับข้อมูลได้2.Nameservers ในส่วนนี้หากต้องการใช้งาน Nameserver เป็นของตัวเองบนเครื่อง Serverสามารถกำหนดตั้งค่าได้ในส่วนนี้ โดยจะต้องทำการ register nameserver ของ Domain ที่จะใช้งานก่อน ซึ่งในส่วนของขั้นตอนการทำนั้น ต้องติดต่อกับผู้ให้บริการโดเมนเป็นคนดำเนินการตัวอย่าง Nameserver Step 3: Server Time Home »Server Configuration »Server Timeตัวอย่างสามารถเลือกTimezone ตามที่เราต้องการใช้งานได้โดยประเทศไทยนั้นจะเลือกเป็น Asia/Bangkok Step 4: Edit System Mail Preferences Home »Server Contacts »Edit System Mail Preferencesขั้นตอนนี้จะเป็นการกำหนดการแจ้งเตือนเหตุการณ์ต่างๆที่เกิดขึ้นบนระบบทั้งหมดของ cPanel/WHMตัวอย่าง Step 5: Password Strength Configuration Home »Security Center »Password Strength Configurationขั้นตอนนี้จะเป็นการกำหนดความยากในการสร้าง Password ต่างๆทั้งหมดของระบบ ซึ่งรวมไปถึงการสร้างอีเมล์ ด้วย โดยการเลือกค่าความยากของ Password ที่เหมาะสมและปลอดภัยนั้น ควรจะมีค่ามากกว่า 70 ขึ้นไป ตัวอย่าง Step 7: shell Fork Bomb Protection Home »Security Center »Shell Fork Bomb Protectionเปิดใช้งาน Service ดังกล่าวเพื่อป้องการการเข้าถึง Server ผ่าน SSH/Telnet ที่ไม่พึงประสงค์โดยทำการคลิก Enablesตัวอย่าง Step 8: Configure ClamAV Scanner Home »cPanel »Manage Pluginsคลิกเลือก ปุ่ม Install "ClamAV for cPanel" ตามตัวอย่างด้านล่างตัวอย่าง สำหรับ plugin นี้จะคอยช่วย Scan file ต่างๆบนระบบที่เข้าข่ายสุ่มเสียงหรือไฟล์แปลกปลอม Step 9: Exim Configuration Manager Home »Service Configuration »Exim Configuration Managerสำหรับในส่วนนี้จะเป็นการตั้งค่าเกี่ยวกับระบบอีเมล์ทั้งหมดซึ่งสามารถตั้งค่าได้ตามความเหมาะสมต่อการใช้งาน โดยพื้นฐานสิ่งที่ควรจะเปิดใช้งานมี 10 อย่างดังนี้ 1.Apache SpamAssassin™ reject spam score threshold = 132.Reject remote mail sent to the server's hostname = On3.Apache SpamAssassin™: ratelimit spam score threshold = 12.54.Ratelimit incoming connections with only failed recipients = On5.Apache SpamAssassin™: bounce spam score threshold = 106.RBL: bl.spamcop.net = On7.RBL: zen.spamhaus.org = On8.Require clients to connect with SSL or issue the STARTTLS command before they are allowed to authenticate with the server. = Off9.Apache SpamAssassin™: Forced Global ON = On10.Apache SpamAssassin™: message size threshold to scan = 200 KB
หลังจากได้เครื่องที่ลง CentOS7 มาแล้วให้ดำเนินการติดตั้งตามขั้นตอนดังนี้
1. Yum Update , Install nano , perl curl
yum update -y
yum install perl nano curl -y
2. Disable NetworkManager
nano -w /etc/sysconfig/network-scripts/.... ifcfg-eth0 and ifcfg-lo
Edit file ifcfg-eth0 and ifcfg-loNM_CONTROLLED=no ONBOOT=yes
systemctl enable network.service
systemctl start network.service
3.Disable SELinux
nano -w /etc/selinux/config
SELINUX=disabled
4. Installation cPanel
cd /home
curl -o latest -L https://securedownloads.cpanel.net/latest
sh latest
https://verify.cpanel.net/app/verify
---END---
5. ทดสอบเรียกใช้งาน ผ่าน https://
ขั้นตอนการ Install PHP Version For DirectAdmin (Custom Build) 1. SSH เข้าที่ server direct admin ที่ใช้งาน 2. ไปที่ Path Custom Build cd /usr/local/directadmin/custombuild 3. ทำการ update Custom build ด้วยคำสั่ง ./build update 4. แก้ไข File: options.conf nano -w options.conf โดยเลือกแก้ไขในส่วนของ PHP Version ที่ต้องการ Install เพิ่มไป โดยใส่เป็นตัวเลข Version ไว้ที่ php1 ตามรูปคือ 5.6 และ mode = suphp (หากมี version ที่ใช้งานอยู่แล้ว ให้เปลี่ยนไปไว้ที่ php2 เพื่อให้ select php เพิ่มเติมได้ ) #PHP Settingsphp1_release=5.6php1_mode=suphp php2_release=7.2php2_mode=suphpphp3_release=nophp3_mode=php-fpmphp4_release=nophp4_mode=php-fpm 5. หลังจากแก้ไขแล้วให้รันคำสั่งเพื่อทำการ Build PHP Version ที่กำหนดไป ./build php n 6.หลังจากนั้นให้ทำการตรวจสอบโดยการรันคำสั่ง php -v จะได้ Main PHP Version ที่ทำการ Build ไป หรือทำการตรวจสอบผ่าน DirectAdmin Control Panel เมนู Domain Setup