-
-
Save scsskid/0b9cee6f46a2bd0a9f6074181c0426e4 to your computer and use it in GitHub Desktop.
How to backup your LAMP / LEMP installation the right way #bash #ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Introduction | |
This is the LAMP / LEMP environment backup guide in case you want or need to try my [highload LEMP installation](https://github.com/sutlxwhx/highload-lemp-installation). | |
## Basic usage | |
As a first thing we will setup a variable that will store current date and time. We will use year-month-day_hours-minutes-seconds format: | |
```shell | |
now=$(date +"%Y-%m-%d_%H-%M-%S") | |
``` | |
Then we need to create a folder where Nginx configuration files will be stored: | |
```shell | |
mkdir /backup/$now/nginx/ | |
``` | |
We will repeat previous step for your PHP installation: | |
```shell | |
mkdir /backup/$now/php/ | |
``` | |
If you already have MySQL or MariaDB installed do this step too: | |
```shell | |
mkdir /backup/$now/mysql/ | |
``` | |
This is the main backup process, just copy files from one folder to another. | |
<br/> For Nginx: | |
```shell | |
cp -r /etc/nginx/ /backup/$now/nginx/ | |
``` | |
For PHP: | |
```shell | |
cp -r /etc/php/ /backup/$now/php/ | |
``` | |
For MySQL / MariaDB: | |
```shell | |
cp -r /etc/mysql/ /backup/$now/mysql/ | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment