Backing Up and Restoring TYPO3 WebsitesAhren Stevens-Taylor
What Needs Backing Up in TYPO3?
We need to back up:
- The TYPO3 files
- A copy of the database
These two things make up our TYPO3 installation. We need the database as it contains the website’s content and records of the website’s users. We need the TYPO3 files as they contain the website’s settings in the configuration files, copies of the website’s design, and copies of data that has been cached by TYPO3.
Backing Up the TYPO3 Files
Depending on the operating system we are using, there are a number of different ways in which we can back up the files from TYPO3. In this article, we will look into backing up the files on Windows and on Linux. This is because Windows is the most used operating system, and Linux is the most popular hosting environment for websites.
Backing Up Our Files on Windows
In Windows, we can easily create a compressed file containing all the TYPO3 files (known as a ZIP file), using the Windows Compressed Folder tool, or a program such as WinZip.
Provided we’ve used the default installation path, TYPO3 will be located in the folder C:Program FilesTypo3_4.0.2Apache and the folder that we want to compress is typo3_src. We could just back up the fileadmin, typo3conf, and uploads folders. This way, should we lose our entire website, we can simply restore the whole thing instead of having to restore TYPO3 and then our extra TYPO3 files.
Now that we have a backup, we should copy it to a separate location (preferably on an external disk, or on another computer) for safe keeping.
Backing Up Our Files on Linux or Linux Hosting
We can create a complete backup of our home directory on a Linux hosting environment. This home directory contains all of our files on the hosting account. Alternatively, we can run a simple command to compress a particular folder.
If we have a web hosting account that provides us with access to the cPanel hosting control panel, we can use that to generate a backup of our entire website (except for the database—which is done separately via cPanel).
To access the backup utilities, we need to log in to cPanel, which is located at www.ourdomain.com/cpanel, and then enter our hosting account’s username and password. In cPanel, we have the backup option on the main screen, as shown in the following screenshot:
The Backups section has a number of options, but the one that we want is the Download a home directory Backup. This will generate a backup of all the files of our website and allow us to download it.
In the previous screenshot, there is a warning message. This is because my web server does not have the option to back up the entire server, just an individual
The backup tool then takes a moment or two of processing, and then prompts us to download the backup file.
To create a backup via the command line, we need to have SSH access to the server that is hosting our website. SSH is a protocol that allows us to remotely administer another machine using the command line.
We can use a program such as Putty to connect to the server. We can download Putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/. Putty only needs to be downloaded, after which it can be run straight away, and does not require to be installed.
When we open the program, we are presented with a screen similar to the one shown in the following screenshot. We enter the server’s address (i.e. the web address) into the Host Name box and then click on Open.
Putty will then try to connect to the server, and will prompt us to enter our username and password, as shown in the following screenshot:
Once we are connected, we can type two commands to back up our site. The first is to navigate to the folder that contains our TYPO3 installation. This depends entirely on the server’s setup and your username, but is generally /home/the first 8 characters of your web address/public_html (you should contact your web host for more information or if you need help).
Once we are in the correct folder, we can use the tar command to compress our TYPO3 folder to a single file named TYPO3.
tar cvzf file.tar.gz typo3
Now that we have our backup created, we can download it from www.ourwebaddress.com/file.tar.gz (where we will be prompted to save the file). We should then delete this from our server once we have downloaded it.