ขั้นตอนการติดตั้ง Zabbix agent บน Windows server 1. ทำการ Remote Desktop เข้าที่ Server ที่ต้องการติดตั้ง 2. ทำการ Download โดยสามารถทำการ Download ผ่าน Browser 3. ทำการ Extract file ที่ได้จากการ Download และทำการติดตั้ง ตามรายละเอียดด้านล่าง 4. ทำการ Download file Config และ File get metadata โดยสามารถทำการ Download ได้ที่ : http://203.78.107.84/zabbix_windows.tar.gz 5. ทำการ Extract file Config และ File get metadata จะได้ไฟล์ - zabbix_agentd.conf - get_server_for_zabbix.pl 6. ทำการ Move file ที่ได้ไปที่ C:\Program Files\Zabbix Agent 7. ทำการแก้ไขไฟล์ zabbix_agentd.conf โดยให้ทำการแก้ไขในส่วนของ- Server=203.78.103.9 - ServerActive=203.78.103.9 - Hostname=[Servername] 8. ทำการติดตั้ง Strawberryperl เพื่อให้สามารถใช้งานคำสั่ง perl ได้ - Download and setup perl from http://strawberryperl.com - Install CPAN module with command line ผ่านโปรแกรม strawberryperl > cpan Win32 Net::Domain User Win32::Service 9. เปิดโปรแกรม Powershell จากนั้น Run คำสั่ง - ทำการ Run : cd 'C:\Program Files\Zabbix Agent\' -ทำการ Run : perl .\get_server_for_zabbix.pl 10. ทำการ Allow port 10050 , 10051 , 10052 ในส่วนของ Firewall ทั้ง TCP IN และ TCP OUT 11. ทำการ Restart zabbix_agentd โดยสามารถดำเนินการได้โดย - กดที่เมนู Run จากนั้นใส่ข้อมูล services.msc - ทำการ Restart zabbix_agentd
การติดตั้ง mytop เพื่อให้ monitor process : mysql 1. ทำการติดตั้ง Package epel-release [root@system ~]#yum install epel-release 2. ทำการติดตั้ง Mytop เพื่อใช้ในการ Monitor การทำงานของ mysql database [root@system ~]#yum install mytop 3. ทำการแก้ไข Config mytop [root@system ~]#nano -w /root/.mytop db=mysqldelay=2 4. ทดสอบการใช้งานคำสั่ง mytop จะพบ process mysql database ที่มีการ query อยู่ปัจจุบัน MySQL on localhost (5.7.27) up 6+20:23:37 [13:43:04] Queries: 18.0 qps: 0 Slow: 0.0 Se/In/Up/De(%): 44286894/00/00/00 qps now: 1 Slow qps: 0.0 Threads: 1 ( 1/ 9) 00/00/00/00 Key Efficiency: 99.9% Bps in/out: 0.0/ 0.2 Now in/out: 21.0/ 5.1k Id User Host/IP DB Time Cmd Query or State -- ---- ------- -- ---- --- ---------- 491510 root localhost mysql 0 Query show full processlist
วิธีติดตั้งและต่ออายุ Free SSL (Let's Encrypt ) แบบ Manual 1. ทำการ Verify website เพื่อ Generate Key , CA และ Certificate โดยสามารถทำการ Verify website ได้ที่ https://www.sslforfree.com/ - ให้ทำการกรอกข้อมูล Domain ที่ต้องการติดตั้ง Free ssl - ทำการเลือก Manual Verification - จากนั้นทำการ Download file เพื่อ Verify domain โดยให้ทำการ Download file และนำไฟล์ไปไว้ที่ Part file ที่เรียกใช้งาน Website ทั้งนี้รูปแบบการ Verify จะต้องทำการ Upload file ไปไว้ที่ /.well-known/acme-challenge/filename ตัวอย่างเช่นทำการ Upload file name : JUUOCxh14V0Q-yDbvR8Lsnr5nvWe2z26_y-nrRxBjaE นำไปไว้ที่ Part file : /var/www/html//.well-known/acme-challenge/JUUOCxh14V0Q-yDbvR8Lsnr5nvWe2z26_y-nrRxBjaE 2. เมื่อทำการ Verify website เรียบร้อยแล้วจะได้รับ Key , CA และ Certificate 3. SSH เข้าที่ Server ที่ต้องการ จากนั้นให้การสร้างไฟล์เพื่อเก็บข้อมูล Key , CA และ Certificate ที่ได้รับมา [root@system ~]# mkdir /etc/httpd/private[root@system ~]# cd /etc/httpd/private[root@system ~]# nano -w cafilename.ca-bundle[root@system ~]# nano -w certificatefilename.crt[root@system ~]# nano -w keyfilename.key 4. ทำการแก้ไขไฟล์ Config SSL เพื่อให้สามารถเรียกใช้ Key , CA และ Certificate ที่ได้รับมาได้ [root@system ~]# nano -w /etc/httpd/conf.d/ssl.conf - ทำการแก้ไข Part file Key # Server Private Key:# If the key is not combined with the certificate, use this# directive to point at the key file. Keep in mind that if# you've both a RSA and a DSA private key you can configure# both in parallel (to also allow the use of DSA ciphers, etc.)#SSLCertificateKeyFile /etc/pki/tls/private/localhost.keySSLCertificateKeyFile /etc/httpd/ssl/private/ezazbweb1.key - ทำการแก้ไข Part file Certificate # Server Certificate:# Point SSLCertificateFile at a PEM encoded certificate. If# the certificate is encrypted, then you will be prompted for a# pass phrase. Note that a kill -HUP will prompt again. A new# certificate can be generated using the genkey(1) command.#SSLCertificateFile /etc/pki/tls/certs/localhost.crtSSLCertificateFile /etc/httpd/ssl/private/ezazbweb1.crt - ทำการแก้ไข Part file CA # Certificate Authority (CA):# Set the CA certificate verification path where to find CA# certificates for client authentication or alternatively one# huge file containing all of them (file must be PEM encoded)#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crtSSLCACertificateFile /etc/httpd/ssl/private/ezazbweb1.ca-bundle 5. ทำการ Restart apache service [root@system ~]# systemctl restart httpd
วิธีการ Custom logrotate on Ubuntu server 1. ssh login เข้าที่เครื่องที่ต้องการ 2. ทำการสร้างไฟล์ที่ต้องการ Custom config [root@system ~]# cd /etc/logrotate.d/ [root@system ~]# touch mongodb 3. ทำการ Config part และช่วงเวลาที่ต้องการทำ logrotate [root@system ~]# nano -w /etc/logrotate.d/mongodb /var/log/mongodb/*.log { *** Part ที่ต้องการทำ Logrotate *** weekly missingok rotate 14 *** ช่วงเวลาในการเก็บ Logrotate หน่วยเป็นสัปดาห์ *** compress notifempty } 4. ทำการ Force update Logrotate [root@system ~]# logrotate /etc/logrotate.conf --state /var/lib/logrotate/logrotate.status --verbose --force 5. ตรวจสอบ logrotate.status จะพบ validate log ที่ทำการ Custom ขึ้นมา [root@system ~]# more /var/lib/logrotate/logrotate.status "/var/log/nginx/error.log" 2019-7-15-3:34:1"/var/log/mongodb/mongod.log" 2019-7-3-2:42:56"/var/log/yum.log" 2019-6-15-3:7:1"/var/log/rabbitmq/rabbit@eza_upgrade.log" 2019-5-24-3:30:1"/var/log/boot.log" 2019-1-9-16:44:1"/var/log/rabbitmq/rabbit@eza.log" 2019-7-14-3:48:1
1. ssh login เข้าที่เครื่อง Directadmin ที่ต้องการ 2. ทำการ Download script ในการแปลงข้อมูล [root@system ~]# wget https://www.pusathosting.com/file/da.cpanel.import.9.4.tar.gz 3. ทำการสร้าง Directory เพื่อเก็บข้อมูล [root@system ~]# mkdir import export 4. ไปที่เครื่อง cPanel ที่ต้องการ Migrate data ให้ทำการทำ Full backup ของ Account ที่ต้องการโดยสามารถดำเนินการได้ 2 วิธี - วิธีที่ 1 ทำการ Run script เพื่อทำการ Backup [root@system ~]# /scripts/pkgacct USERNAME - วิธีที่ 2 ทำการ Full backup ผ่าน Tools บน cPanel 5. ทำการ rsync data จาก cPanel ไปที่ Directadmin (Run ที่เครื่อง cPanel) [root@system ~]# rsync -av /home/cpmove-USER.tar.gz root@x.x.x.x:/root/import 6. ทำการแก้ไข Config ที่ไฟล์ defaults.conf ip=203.78.103.158 *** แก้ไข ip server ***ns1=ns1.cdnex.co.th *** แก้ไข Nameserver ***ns2=ns2.cdnex.co.th *** แก้ไข Nameserver ***creator=admindocsroot=./data/skins/enhancedaccount=ONaftp=OFFcgi=ONdnscontrol=OFFnemailr=unlimitednemails=unlimitedpackage=customphp=ONskin=enhancedssh=OFFssl=ONsuspend_at_limit=ONsuspended=nozoom=100 7. ทำการแตกไฟล์ da.cpanel.import.9.4.tar.gz [root@system ~]# tar -xvzf da.cpanel.import.9.4.tar.gz 8. Run script [root@system ~]# perl da.cpanel.import.pl 9. เมื่อทำการ Run script เรียบร้อยแล้ว Script จะทำการแปลงไฟล์ Backup cPanel ไปเป็น Backup Directadmin โดยจะนำไฟล์ที่มีการแปลงสมบูรณ์แล้วไปเก็บไว้ที่ Directory : export ที่สร้างไว้ก่อนหน้านี้ ให้ทำการย้ายไฟล์ Backup ที่ได้ไปไว้ที่ /home/admin/user_backups/ [root@system ~]# mv /root/export/admin.tar.gz /home/admin/user_backups/ 10. ทำการ Login Dashboard Directadmin Go to reseller-level >> Manage User Backups >> Restore Backup >> จากนั้นทำการเลือกไฟล์ Backup ที่ต้องการ Restore ได้เลย