Setting up automatic cPanel backups with JetBackup5

Setting up automatic cPanel backups with JetBackup5

In this guide, I will be setting JetBackup5 on a new server, with a remote (SSH) destination, and scheduling daily cPanel backups.

The following should be already created:

  • JetBackup5 license is activated for the server IP
  • SSH account created on the remote destination server

Install JetBackup5

Enable the JetApps repository:

bash <(curl -LSs http://repo.jetlicense.com/static/install)

Install JetBackup 5 on cPanel server:

jetapps --install jetbackup5-cpanel stable
image 31 - Setting up automatic cPanel backups with JetBackup5

Navigate to WHM > JetBackup5 and accept the license:

image 32 1024x517 - Setting up automatic cPanel backups with JetBackup5

Select New installation, then OK, and finally Finish button.

image 33 1024x517 - Setting up automatic cPanel backups with JetBackup5

Enable SSH plugin

In JetBackup5 you need first to install a plugin to use SSH as remote destination.

From WHM > JetBackup >Plugins click on Available plugins.

image 22 1024x697 - Setting up automatic cPanel backups with JetBackup5

Find the SSL plugin and click on Install, then OK

image 23 1024x464 - Setting up automatic cPanel backups with JetBackup5

then on Enable plugin.

image 24 1024x455 - Setting up automatic cPanel backups with JetBackup5

Now that the SSH plugin is active, We can add our destination server.


Create a new SSH destination

From JetBackup click on Destinations and Create a New Destination.

image 25 - Setting up automatic cPanel backups with JetBackup5

Set destination type to SSH

image 26 - Setting up automatic cPanel backups with JetBackup5

Fill in the server name:

image 27 - Setting up automatic cPanel backups with JetBackup5

If you will be storing backups on this remote server from multiple servers, set also the directory:

image 28 - Setting up automatic cPanel backups with JetBackup5

Then fill in the SSH login details:

image 29 - Setting up automatic cPanel backups with JetBackup5

I recommend creating a new SSH user that will be used exclusively for backups. Also for authentication, I recommend using a private key.

Save the settings and the new destination will be validated:

image 30 1024x405 - Setting up automatic cPanel backups with JetBackup5

Create a new Backup job

After the destination is added, We can create a new backup job to enable automatic backups.

Create a new Backup Job and set the following:

  • Name for the destination
  • Destination: Newly created SSH remote destination
image 38 - Setting up automatic cPanel backups with JetBackup5

Create a new Account filter to exclude suspended accounts:

image 36 - Setting up automatic cPanel backups with JetBackup5

I also recommend excluding archives, cache, and backup directories:

image 37 - Setting up automatic cPanel backups with JetBackup5

Click on Insert Multiple and just paste these files:

/tmp/*
/.cpanel/*
*/error_log*
/public_ftp/*
*/*.log*
backup-*.tar.gz
cpmove-*.tar.gz
site-*.tar.gz
public_html/cache/*
softaculous_backups/*
*/wp-content/cache/*
/wp-content/backups/*
/wp-content/updraft/*
/wp-content/ai1wm-backups/*

and set the Schedule, in this example, I will set the backups to run daily and save up to 8 backups for each account.

image 39 - Setting up automatic cPanel backups with JetBackup5

Additional Recommended Jetbackup5 settings

Here are a few recommended JetBackup5 settings:

Change JetbaCkup5 folders

I recommend changing the JetBackup5 Workspace and Downloads directories (that jb5 uses to download and create backups) to something other than /usr – in most cases you should use /home

First copy the current folders:

cp -a /usr/local/jetapps/usr/jetbackup/workspace /home/backupjb
cp -a /usr/local/jetapps/usr/jetbackup/downloads /home/downloadjb

Then navigate to Settings > General and change them both:

image 40 1024x523 - Setting up automatic cPanel backups with JetBackup5

to

image 41 - Setting up automatic cPanel backups with JetBackup5

then save the settings.


Limit CPU and IO usage

It is possible that Jetbackup uses all available resources if not limited, so make sure to limit CPU and IO usage accordingly to your server hardware:

image 42 1024x507 - Setting up automatic cPanel backups with JetBackup5

Change Postgre Configuration

To avoid errors when backing up postgre databases, you should change the default pg_hba.conf file:

nano /var/lib/pgsql/data/pg_hba.conf

and change

host samerole all  ::1/128      md5

to

host all all  ::1/128      md5

Save, then restart Postgres and JetBackup:

service postgresql restart
service jetbackup5d restart

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.