How to Configure cPanel Backups

For cPanel & WHM version 11.52+

In WHM, the Backup Configuration section is located at Home >> Backup >> Backup Configuration

NOTE: It is strongly recommended that you only use the Backup Configuration interface to configure backups for your server. cPanel plans to remove the Legacy Backup Configuration interface located at Home >> Backup >> Legacy Backup Configuration from WHM in a future release.

To enable and run backups, you must complete both of the following steps:

Select Enable for the Backup Status setting in this interface’s Global Settings section.
Select your desired settings for the Backup Configuration feature.
Use the Backup User Selection interface located at Home >> Backup >> Backup User Selection to enable backups for each desired cPanel user.

Global Settings
Backup Status – Enable this in order to run the updated Backup Configuration feature. Default for this setting is Enable.
Backup Type – Choose one of the following to determine how backups are stored on yoru system.

Compressed: Saves in compressed format. Uses less space but takes longer to finish.
Uncompressed: Saves in uncompressed format. Uses more space but runs faster than compressed backups.
Incremental: Stores only one uncompressed backup file. Backups will save any updated information to the existing backup and remove any old information tghat these updates replaced. This option runs fasterand uses less disc space than the other types of backups but it will limit your restoration settings.

Maximum Destination Timeouts in Seconds – The maximum time (in seconds) to allow the backup process to upload a single backup file. This should be a number that is large enough to upload your largest backup file.

Scheduling & Retention
The Scheduling and Retention settings allow you to specify when the backup process runs. You may choose to run backups on a daily, weekly, or monthly basis, or you may use a combination of these settings. Select the checkboxes that correspond to the timing settings that you wish to use.

You must select at least one the following settings:

Backup Daily: Your system creates a new backup on each of the days of the week that you select. WHen using this setting, you must also configure the following: Days of the week when you wish the backups to run and enter the maximum number of daily backups files to store on your system at any given time. This number should be between 1 and 9999 and is found in the Retain Daily Backups text box.

Backup Weekly: Your system will create a new backup, once per week on the day you select. When using this option, you must also configure the day of the week when you want these to process and you’ll also need to select the total number of weekly backups the system should store at any given time. Enter any number between 1 and 9999

Backup Monthly: Your system will create a new backup either once or twice per week ,on the days of the month that you prefer. When using this option, you must also select the day or days of the month when you wish for the backups to run. You’ll also need to select the number of monthly backups that the system should have saved at any given time. You can use any number between 1 and 9999.

NOTE: If you are running daily and monthly backups at the same time, the daily backups will process first. The monthly backup will then copy the daily backups.

Files
This setting allows you to configure the data you wish to backup. Please note that you will need to select either Backup Accounts or Backup System Files in order to run backups.

Backup Accounts: Backs up the user files in each cPanel user’s home directory. Click on Select Users top open the Backup User Selection interface located at Home >> Backup >> Backup User Selection.
After choosing this setting, select the type of data to include in the backup.

Backup Suspended Accounts: Select Enable to also backup suspended accounts. (Warning: If you do not enable this option, your server will not back up suspended accounts regardless of their settings in the Backup User Selection interface.)
Backup Access Logs: Select Enable to also back up up your server’s access logs and domlogs
Backup Bandwidth Data: Will also back up your server’s bandwidth data.
Use Local DNS: When disabled the system will back up DNS data from the DNS cluster. When enabled, the system will back up the DNS information from the server for the domain.
Backup System Files: Will back up your server’s system logs.
The system stores many of these files in the /etc directory
You must enable this seeting for server restoration but it is not needed for individual account restores. Enabling this setting is highly recommneded.
Databases
Select one of the following options for the Backup SQL Databases setting, to determine how to back up SQL databases:

Per Account Only: Only backs up the databases for each account. uses the mysqldump utility
Entire MySQL Directory: Backs up all of the databases on the server. Will back up the /var/lib/mysql directory.
Per Account and Entire MySQL Directory: Performs a comprehensive backup that copies all of the databases for each account as well as all of the databases on the server.
Configure Backup Directory
The following settings allow you to specify where you wish to save your backups. It is recommended that you save backups to a remote location as well as a local destination. If you do not select Retain backups in the default backup directory and do not specify a desination in the Additional Destinations setting, the system will return the following error: Error: Nowhere to back up: no enabled destinations found and retaining local copies is disabled. Backups to NFS mount points are done at your own risk. If you choose a NFS mount point, you risk data loss if there is a network issue.

Default Backup Directory – To change the default backup directory, enter the absolute path of the desired location. By default, the system saves backups files locally to the /backup/ folder.
Retain Backups in the Default Backup Directory – Select to retain each account backup in the /backup/ folder after the backups transfer to a remote destination.
Mount Backup Drive as Needed – Enable this setting to mount a backup drive. This requires a seperate mount point and will cause the Backup Configuration process to check the /etc/fstab file for a backup mount. If a mount exists with the same name as the staging directory, the Backup Configuration process mounts the drive and backs up the data to the mount. After the backup finishes, the drive is dismounted
Additional Destinations
You can also save your backups to additional destinations. Each additional destination may increase the amount of time that the backup process requires. If the process runs too long, it may interfere with the next backup process so use caution.
To restore backups that exist in the additional destinations that you create, perform a remote restoration.
If you use the Incremental backup type, you cannot add additional destinations.
To save your updated destination but not validate your changes, click Save Destination.
To automatically validate your information after you save your changes, click Save and Validate Destination.
Select a destination type from the menu and click Create new destination. A new section for the selected destination type will appear.
Only transfer system backup files over encrypted connections. The following destination types use encrypted connections:

Amazon S3™
SFTP
WebDAV with SSL Enabled
The Additional Local Directory type does not transfer your data from the server, so that method is secure.

Save Configuration
After you configure the desired settings, click Save Configuration at the bottom of the Backup Configuration interface. To reset all of the settings in the Backup Configuration interface to the default settings, click Reset.

Run Backups Manually
To run a backup manually, run the following command:

/usr/local/cpanel/bin/backup

If the backup is up-to-date but you still wish to perform a backup, run the following command:

/usr/local/cpanel/bin/backup

–force

To use a custom packaging script, perform the following steps:

Copy the
/usr/local/cpanel/scripts/pkgacct
file and modify it.
Store the modified
pkgacct
file in the
/var/cpanel/lib/Whostmgr/Pkgacct/pkgacct
directory.
Run the
/usr/local/cpanel/bin/backup
command with the
–allow-override
flag.
Backup Files and Directories
When you select Backup Configuration Files, cPanel & WHM backs up the following files and directories:

Files

/etc/exim.conf
/etc/exim.conf.local
/etc/exim.conf.localopts
/etc/namedb/named.conf
/etc/rc.conf
/etc/named.conf
/etc/proftpd.conf
/etc/localdomains
/etc/httpd/conf/httpd.conf
/etc/group
/etc/shadow
/etc/master.passwd
/etc/passwd
/etc/fstab
/etc/ips
/etc/ips.remotemail
/etc/ips.remotedns
/etc/reservedips
/etc/reservedipreasons
/etc/quota.conf
/etc/wwwacct.conf
/etc/remotedomains
/etc/rndc.conf
/etc/secondarymx
/etc/my.cnf
/root/.my.cnf
/usr/local/apache/conf/httpd.conf
Directories

/etc/namedb
/etc/valiases
/etc/proftpd
/etc/vdomainaliases
/etc/ssl
/etc/vfilters
/usr/local/frontpage
/usr/share/ssl
/usr/local/cpanel/3rdparty/mailman
/var/lib/rpm
/var/lib/named/chroot/var/named/master
/var/named
/var/cpanel
/var/spool/cron
/var/cron/tabs
/var/spool/fcron
/var/log/bandwidth
/var/ssl
/var/lib/mysql

To configure system backups to include custom files or directories, create a new file or directory in the
/var/cpanel/backups/extras
directory (for example,
/var/cpanel/backups/extras/etc)
. In that file, enter an absolute path to any files that you wish to back up (for example,
/etc/example.conf
).

Note:

The server administrator can edit the
/etc/my.cnf
file to change the MySQL data directory location. In such a case, WHM will back up the directory at its new location.

About the Author

Leave a Reply

%d bloggers like this: