المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : اخذ باك اب export config لجميع اعدادات السيرفر WHM من خلال cpconftool Script



Rise Company
08-05-2020, 23:20
اخذ باك اب لجميع اعدادات السيرفر WHM من خلال cpconftool Script
export config - Export only the WHM settings to a new server?
Back up a configuration module / restore - how to export whm server configuration
Clone a cPanel server configuration to a new server

https://www.rise.company/forum/images/imported/2020/05/19.jpg



Is there anything within WHM that I can export which will show the current config versions of things
such as PHP, MYSQL, Apache, PHPSU/Mod Ruid2 etc etc.



I would like to export only the settings I have already made.
How to: General Settings, Apache, Preferences ...
I do not want to configure everything again, is there any solution to this, besides the transfer tool?


نعم , يمكنك اخذ باك للسيرفر كامل< ولكن يجب ان تعلم ان كل شىء داخل السيرفر بيكون عبارة عن Modules


--------------------------------------------------------------------
انواع Modules داخل WHM التى يمكن عمل لها Backup / Restore
--------------------------------------------------------------------



Apache® — cPanel & WHM uses Apache to host websites.
AutoSSL — The AutoSSL feature automatically issues free, Domain-Validated SSL certificates to users’ domains.
Backups — cPanel & WHM uses backups to copy or archive data. You can use this data to recover to a previous state.
cPanel themes — cPanel & WHM uses cPanel themes to generate the cPanel and the WHM interfaces.
cPHulk — The cPHulk service helps to protect your server against brute force attacks.
Exim — cPanel & WHM uses Exim as the server’s main mail transfer agent.
GreyListing — The Greylisting feature defends email users against spam.
ModSecurity — This open-source web application firewall helps to detect and prevent intrusion. For more information.
MySQL® — cPanel & WHM uses MySQL as the server’s database management.
WHM (whmconf) — cPanel & WHM uses the whmconf service to back up and restore WHM’s common settings that aren’t user-specific. For example, the settings from WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings) and WHM’s Basic WebHost Manager Setup interface (WHM >> Home >> Server Configuration >> Basic WebHost Manager Setup).


--------------------------------------------------------------------
سكربت Backup / Restore للـ Modules
--------------------------------------------------------------------

هذا هو السكربت


usr/local/cpanel/bin/cpconftool --option

مع استبدال --option بالمطلوب سواء باك اب / ريستور + الموديل الذى تريده من list-modules

--modules — (Required) A comma-separated list of the modules to restore or back up.
--backup — Generate a backup file.
--restore — Restore from a backup file.
--list-modules — List the available modules on your server.

--query-module-info — List information about the version of the module.
--verbose — Display details about the operation that the script performs.
--prerestore_backup — Restore the original version of the file.

ادخل هذا الكود لكى تجد اسماء الموديل التى هتقوم بعمل لها باك اب او ريستور


/usr/local/cpanel/bin/cpconftool --list-modules

بداخل list-modules يوجد :


cpanel::easy::apache
cpanel::smtp::exim
cpanel::system::autossloptions
cpanel::system::backups
cpanel::system::greylist
cpanel::system::hulk
cpanel::system::modsecurity
cpanel::system::mysql
cpanel::system::whmconf
cpanel::ui::themes

--------------------------------------------------------------------
كيفية عمل باك اب Backup a configuration module
--------------------------------------------------------------------

هنا ادخل هذا الامر فى الشل لعمل باك اب للـ Configuration للموديل المطلوبة وهم 10 فقط


/usr/local/cpanel/bin/cpconftool --backup --modules=configuration::to::backup

مع استبدال configuration::to::backup بـ cpanel::system::whmconf
مثلا لكى يتم اخذ الباك له فقط وكذلك يتم العمل على الباقي بنفس الطريقة



/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::easy::apache
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::smtp::exim
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::autossloptions
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::backups
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::greylist
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::hulk
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::modsecurity
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::mysql
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::whmconf
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::ui::themes


اما اذا كنت تريد جميع من فى list-modules قم باستخدام هذا الكود جاهز

حيث تم وضع جميع modules مع وجود فاصلة بينهم لكى يكون الباك اب شامل


/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::easy::apache,cpanel::smtp::exim,cp anel::system::autossloptions,cpanel::system::backu ps,cpanel::system::greylist,cpanel::system::hulk,c panel::system::modsecurity,cpanel::system::mysql,c panel::system::whmconf,cpanel::ui::themes

ثم النتيجة


Backup Successful
/home/whm-config-backup-1562881772.tar.gz

--------------------------------------------------------------------
كيفية عمل استعادة Restore configuration settings
-------------------------------------------------------------------

هنا ادخل هذا الامر فى الشل لعمل ريستور للـ Configuration للموديل المطلوب وهم 10 فقط


/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=configuration::to::restore

مع استبدال configuration::to::restore بـ cpanel::system::whmconf
مثلا لكى يتم اخذ الباك له فقط وكذلك يتم العمل على الباقي بنفس الطريقة



/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::easy::apache
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::smtp::exim
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::autossloptions
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::backups
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::greylist
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::hulk
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::modsecurity
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::mysql
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::system::whmconf
/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::ui::themes


اما اذا كنت تريد جميع من فى list-modules قم باستخدام هذا الكود جاهز

حيث تم وضع جميع modules مع وجود فاصلة بينهم لكى يكون الريستور شامل


/usr/local/cpanel/bin/cpconftool --restore=/home/backup.tar.gz --modules=cpanel::easy::apache,cpanel::smtp::exim,cp anel::system::autossloptions,cpanel::system::backu ps,cpanel::system::greylist,cpanel::system::hulk,c panel::system::modsecurity,cpanel::system::mysql,c panel::system::whmconf,cpanel::ui::themes

ثم النتيجة

مع مراعاه تغيير اسم الملف restore=/home/backup.tar.gz بالصحيح عندك

ثم النتيجة

هيتم استبدال الاهدادات القديم بالجديدة وفى حالة وجود مشكلة هيتوقف و هيرجع كما كان دون اى مشاكل

The script removes any configuration files on the destination server that did not exist the source server.

When you restore a configuration module, the following actions occur:
The system restores all of the configuration files.
The /usr/local/cpanel/bin/cpconftool script tests whether the configuration settings are valid.

The /usr/local/cpanel/bin/cpconftool script runs the /usr/local/cpanel/scripts/buildeximconf script.
If the test fails, the script reverts the changes.
If the test succeeds, the script restarts the service.

The restoration process returns output that resembles the following example:

فى حالة ان الاستعادة تمت بشكل سليم يظهر لك

Restore Successful
---
cpanel::system::whmconf:
post_restore:
status: 1
statusmsg: Update WHMhostmgr Succeeded
restore:
data:
warnings: []
status: 1
statusmsg: "Whostmgr::Config::Restore::System::WHMConf: ok"

----------------------------------------------------------------
الخلاصة
----------------------------------------------------------------

Cloning should include:
الباك اب يشمل


Tweak Settings (i.e. /var/cpanel/cpanel.config)
Exim Configuration
Feature Lists
Packages
Custom EasyApache Profiles
Reseller ACLs
Statistics Software Configuration
Update Preferences
/var/cpanel/rpm.versions.d
Other settings to be defined


Cloning should explicitly exclude:
الباك اب لا يشمل


IP Addresses
Nameservers
Hostname
cPanel Accounts
Anything that is server-specific


المرجع :
https://documentation.cpanel.net/display/84Docs/The+cpconftool+Script
https://docs.cpanel.net/whm/scripts/the-cpconftool-script/84/
https://forums.cpanel.net/threads/export-config.665433/
https://forums.cpanel.net/threads/export-only-the-whm-settings-to-a-new-server.647121/
https://www.hostgoi.com/my/knowledgebase/48/-Clone-a-cPanel-server-configuration-to-a-new-server-excluding-server-specific-items.html?language=arabic