Best way to backup live lampp server
Hello!
I have a apache2 / php7.4 / mysql sever on ubuntu 20.04. To prevent me from rebuilding the whole thing again, what is the best way to do a complete nightly backup that can be restored easily? Will I need to do a mysqldump and shut down mysql, then backup, or is there something I can use that will not require this? I heard of TimeShift, Bacula, Rsync, Amanda, etc. I do not want to do a file backup (like dropbox or onedrive) I need a complete backup to restore a production server as simply and quickly as possible. I even thought of replicating the mysql databases on another machine, and doing multiple sql dumps that would be rsync'd to another machine as well in addition to creating a complete backup of the drive Thanks for any input |
If you have phpmyadmin installed, it provides backup capability, both for databases and for all files on the site.
In my experience, you can can export your mysql database without shutting dowm mysql. A web search for "phpmyadmin backup" will turn up numerous articles and tutorials. When to back up and how often are more intriguing questions. If the files other than the database change seldom, then there may not be need to back up the non-database files as frequently as the database itself. Many years ago, when I self-hosted my site in my early Linux days (that's how I got into Linux--to self-host my website), I wrote a script to back up my databases every night and ran it as a cron job. For what it's worth, I'd do several things differently today, but here's my old script, in case it gives you a starting point: Code:
#!/bin/bash |
Frank,
Thank you for the response. I have used several sql queries to backup my DB's. Yours is very nice. The greater part of hte question is: What is the most simplistic but solid way to backup the whole server (hard drive) to ensure the site ( /var/www/html) as well as the complete OS can be restored (like clonezilla)? This full 'bare-metal-backup' (excluding /home dir) would allow me to recover to a replacement HD / server/ etc in the event of catastrophic loss. Again, thanks for the wonderful information! |
All times are GMT -5. The time now is 05:23 PM. |