cPanel, Backup and restore of your website

There are several different options for backing up your site, and you may choose one or more of these as part of your backup strategy.

There are several different options for backing up your site, and you may choose one or more of these as part of your backup strategy.


Softaculous Backups

Automated

When installing software through softaculous, you have the option to set up automated backups. You can set the frequency and the number of backups you wish to keep. When you reach the number of backups you set, the oldest backup will automatically be deleted. These backups are stored in your cPanel account and therefore use up some of your quota. For this reason as well as to ensure access to your backups in case of a service interruption, we recommend that you download your softaculous backups and store them in an alternate location. If you do this regularly or let a script do it for you, there is no reason to keep more than one softaculous backup in your account at any time. If you want to use the softaculous restore feature on a backup file you have already downloaded and deleted from the server, you can re-upload the backup file to your softaculous_backups directory using the file manager or any of the other file transfer tools.

Point-in-time 

If you are about to apply updates to your site or make any other significant changes, you will likely want a backup just before you begin making your changes. Softaculous gives you an easy button for that. 

Listing your installations

Navigate to Softaculous and list your All Installationsimage

image

Running the Backup

Click the backup icon imagein the installation list for the website you want to back up

image

Restoring

All the backups for your softaculous linked software can be found by navigating to Softaculous and choosing the Backups and Restore icon image

You can download, delete, or restore any backup directly from this list. 

Backup list 

image


CMS backups

If you are using a CMS for your website, CMS backups should be a part of your backup strategy. If you CMS was linked to Softaculous, the softaculous backups fill this role. If you are using software that is not available through Softaculous, you will need to perform backups as recommended by your software.  Most CMS type software packages have built-in backup and restore features, or have plugins or addons to perform this function. 


Backup Wizard

The backup wizard provides an easy interface for creating and restoring backups. Backups created here will be downloaded to your local machine. You can choose to keep them there or copy them to an alternate location for storage such as UofI Box or other cloud storage solutions. Similarly, when it comes time to restore, you will need to upload the backup you wish to restore into the wizard. It does not retain copies of your backups for you.

Full Backups with Backup Wizard

Full backups performed in the Backup Wizard are cPanel account backups.  They include everything cPanel needs to know to recreate a complete account, usually in order to migrate the account to a new server. You cannot restore your own account, or files and databases from your account using this type of backup. You may run across a use case for these backups, but in most cases you and your customers will want to use the partial backups feature. 

Partial Backups with Backup Wizard

Partial backups allow you to choose between backing up your home directory or backing up your mySQL/MariaDB databases. PostgreSQL databases are not supported by the backup wizard.

Step 1: Select whether you want to back up or restore

image

Step 2: Choose Backup Type 

Click the button for the type of backup you would like to create.


image

Step 3: Download your backup, home directory edition 

image

Step 3: Download your backup, databases edition 

Click the link for the database you wish to back up. Your file will be saved as <databasename>.sql.gz


image

Restores with Backup Wizard

Backup Wizard will allow you to restore a complete backup of your home directory or individual mySQL/mariaDB database backups

Step 1: Choose Restore 

image

Step 2: Choose Restore Type 

image

Step 3: Upload and Restore, Home directory edition 

Click choose file, browse for you file and upload it.

Once you click Upload, there are no further confirmations. A new window will open while your file uploads. Once the upload completes, the restoration will begin immediately.

image

Results 

There won't be feedback until the restoration is complete. 

image

Step 3: Upload and Restore, database edition 

Click choose file, browse for your file and upload it.

Once you click Upload, there are no further confirmations. A new window will open while your file uploads. Once the upload completes, the restoration will begin immediately.

image

Results 

image


Backup Tool

The Backup Tool provides all of the features of the Backup Wizard on one page, along with access to download account backups that have been created automatically by the system.


Database Backups

If your website uses a database, backing up the database(s) should be part of your backup strategy.  If the database is part of a CMS, you should be covered already by the CMS backups or Softaculous backups we already discussed. If you are using mysql, you may have chosen to use the Backup Wizard or Backup feature provided by cPanel. If you are using software that does not provide backup and restore features, or if you prefer to create backups yourself, you can use standard database tools to perform your backups.

Using phpMyAdmin to back up and restore your mySQL database

phpMyAdmin Backup

Using phpMyAdmin to back up your database

1. Open phpMyAdmin from your cpanel dashboard and then choose Export from the toolbar.

image

2. In most cases you can just choose Quick and SQL, then click Go OR Select Custom to review the possible options and make any changes if you have specific requirements.

image

3. Your browser will prompt you to save the backup file. This step will depend on your browser and settings, but on my system, it looks like this:

image

phpMyAdmin Restore 

Using phpMyAdmin to restore your database 

1. Visit phpMyAdmin and choose Import

image

2. Browse for you file and verify the settings, then click Go

image

3. Check your results for any errors

image

Using phpPgAdmin to back up and restore your PostgreSQL database

phpPgAdmin Backup

Using phpPgAdmin to backup your PostgreSQL database 

1. Click Export to backup your database to a downloadable file

image

2. In most cases select "Structure and Data," select your download format and click Export.

image

3. Save your downloaded file to a safe location on your local machine or copy to Box or other alternate storage location.

phpPgAdmin Restore

Using phpPgAdmin to restore from your database backup 

Choose SQL from the toolbar, browse for your file, and click Execute

image

 

Results

Why are there errors in the output?

Have a look at the export file and see which lines are generating errors. In this case, the errors did not interfere your data import. The export file included commands that you didn't need and that you didn't have permission to execute. Experiment with different export settings and with reviewing your backup files and making any needed edits before importing.

The backup file we are importing
PostgreSQL database backup file code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
--
-- PostgreSQL database dump
--
 
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
 
SET search_path = public, pg_catalog;
 
ALTER TABLE ONLY public.examplepgtable DROP CONSTRAINT examplepgtable_pkey;
DROP TABLE public.examplepgtable;
DROP EXTENSION plpgsql;
DROP SCHEMA public;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
 
CREATE SCHEMA public;
 
 
ALTER SCHEMA public OWNER TO postgres;
 
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
 
COMMENT ON SCHEMA public IS 'standard public schema';
 
 
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
 
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
 
 
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
 
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
 
 
SET search_path = public, pg_catalog;
 
SET default_tablespace = '';
 
SET default_with_oids = false;
 
--
-- Name: examplepgtable; Type: TABLE; Schema: public; Owner: jakramer; Tablespace:
--
 
CREATE TABLE examplepgtable (
    examplpg2id bigint NOT NULL,
    examplepg2name character varying(64),
    examplepg2url character varying(256)
);
 
 
ALTER TABLE public.examplepgtable OWNER TO jakramer;
 
--
-- Data for Name: examplepgtable; Type: TABLE DATA; Schema: public; Owner: jakramer
--
 
INSERT INTO examplepgtable VALUES (1, 'docs', 'https://wiki.illinois.edu/wiki/display/cpanelsoft');
INSERT INTO examplepgtable VALUES (2, 'create an account', 'https://go.illinois.edu/cPanelCreate');
INSERT INTO examplepgtable VALUES (7, 'new for import', 'this one is new');
INSERT INTO examplepgtable VALUES (8, 'also new for import', 'this too is new');
 
 
--
-- Name: examplepgtable_pkey; Type: CONSTRAINT; Schema: public; Owner: jakramer; Tablespace:
--
 
ALTER TABLE ONLY examplepgtable
    ADD CONSTRAINT examplepgtable_pkey PRIMARY KEY (examplpg2id);
 
 
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
 
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
 
 
--
-- Name: examplepgtable; Type: ACL; Schema: public; Owner: jakramer
--
 
REVOKE ALL ON TABLE examplepgtable FROM PUBLIC;
REVOKE ALL ON TABLE examplepgtable FROM jakramer;
GRANT ALL ON TABLE examplepgtable TO jakramer;
GRANT ALL ON TABLE examplepgtable TO jakramer_examplepg2user;
 
 
--
-- PostgreSQL database dump complete
--

Database backup and restore from the commandline

There are some cases for which command line backup might be a good option.  One example is databases that are very large. If your database backup file is greater than 50MB, you will not be able to upload the file to phpMyAdmin or phpPgAdmin. Another example is if you want to script regular backups of your databases.

Show code for command line backup and restore 

commandline mysql backup and restore
#Backup jakramerexample database to file jakramerexample.sql as user jakramer_examplemysql
 
 
$mysqldump -u jakramer_examplemysql -p jakramer_examplemysql > jakramerexample.sql
Enter password: ***************
 
 
#Restore jakramer_example.sql to database jakramer_examplemysql2 as user jakramer_examplemysql2
$mysql -u jakramer_examplemysql2 -p < jakramerexample.sql
commandline pg backup and restore
#backup jakramer_examplepg2 database to jakramer_examplepg2.sql as user jakramer_examplepg2user
$pg_dump jakramer_examplepg2 --username=jakramer_examplepg2user > jakramer_examplepg2.sql
Password: ******************
 
#restore jakramer_examplepg2.sql to database jakramer_examplepg as user jakramer_examplepguser
$psql jakramer_examplepguser --username=jakramer_examplepg < jakramer_examplepg2.sql

File System Backups

Creating your own file system backups

Using File Manager 

Making a backup with File Manager

1. Open the File Manager from your cPanel Dashboard and select the files you would like to add to your backup archive

image

2. Click Compress in the tool bar, select your format, and name your backup file

image

3. (Optional, but recommended) Download the backup file you created and store it on your local machine or an alternate location like UofI Box.

From the command line 

From the command line
#there are lots of ways to do this, here is an example of creating an archive of my logs directory. -z for zip, -c for compress, -v for verbose, and -f to specify the filename
 
 
[jakramer@web ~]$ tar -zcvf logs.tgz logs
logs/
logs/jakramer.web.illinois.edu-Jun-2018.gz
logs/jakramer.web.illinois.edu-ssl_log-Jun-2018.gz
logs/jakramer.web.illinois.edu-May-2018.gz
[jakramer@web ~]$ ls
access-logs  jakramer_examplepg2.sql  logs      mail        public_html  tmp
etc          jakramerexample.sql      logs.tgz  public_ftp  ssl          www
 
#download the file for safe keeping. 
#extract the archive as follows, it creates the folder if it doesn't exist or overwrites contents if it does exist, so be careful!
[jakramer@web ~]$ tar -zxvf logs.tgz

System Backups

The service team maintains system backups for disaster recovery purposes. These backups cannot be used for individual file restoration. Content backups are strictly the responsibility of the content owners.

  • AWS Snapshots - nightly, for recovery of the entire web.illinois.edu host in case of catastrophic failure
  • Configuration Backups - nightly, for recovery on host configuration in case of misconfiguration



KeywordscPanel, web hosting, backup, restore cpanelbackups   Doc ID84993
OwnerWeb H.GroupUniversity of Illinois Technology Services
Created2018-08-17 14:52:26Updated2024-01-24 13:27:15
SitesUniversity of Illinois Technology Services
CleanURLhttps://answers.uillinois.edu/uic/pharmacy/cpanelbackups
Feedback  0   0