I have an Ubuntu 18.04 VPS on a hosting company.
I manage it via web panel and SSH from my Windows 10 client.
I would like to full remote backup my VPS for possible future restore.
How can I do from a Win client ?
Thanks
I have an Ubuntu 18.04 VPS on a hosting company.
I manage it via web panel and SSH from my Windows 10 client.
I would like to full remote backup my VPS for possible future restore.
How can I do from a Win client ?
Thanks
Basics
In most cases, you have 3 things to backup:
Anything else is static data and yous should not have to back it up. (i.e. you can recover it by reinstalling the system and your tools/software)
Local Backup with All Properties
Assuming you have enough space on your VPS hard drive, you can first create tarballs of your data, as you see fit. For example, I create one per database so I can restore that specific database and have one large file with everything in it.
Place those in a folder (
/home/backups
in my example here; Ubuntu has/var/backups
, for example) and then with SSH (or SFTP) do a transfer.Multiple Backup Files
Further, you can (probably want to) automate everything. In that case I would strongly suggest that you look into using a date in the filename:
This way you get 7 different files and when you do the transfer you can choose the correct file each time. Also it gives you a few days to detect a problem. You can of course use
%d
, but remember that uses a lot of space on your VPS. Make sure that if you increase the number of backups you will not overflow your available disk space.Note that the
tar
utility andmysqldump
will save all the necessary information to restore the files as required.Transfer
Finally, to do the transfer. You can use SSH or, to make sure you get the latest version, you could use cwRsync. This will get you the files that have changed without you having to do much.
Check the rsync docs for the proper . There are many of them. Test well to make sure you get them right.
Note: I use
rsync
between my Linux boxes, with compression, it works well. However, it would probably not work well between Linux and MS-Windows (Users Names, Permissions, etc.). This is why I suggest you first create tarballs and database dumps as mentioned above. It's a good idea to have tarballs anyway because they can be well compressed. Note that for databases, a dump is the easiest way to make sure you get a correct snapshot.Security
When automating, you need a key without a password. Otherwise you'll have to be at your computer whenever the rsync or SSH transfer starts... not practical.
In order to allow for such, I create a special user that will have his own account (a.k.a.
/home/backups
, user is namedbackups
... hint hint!) I create a key without a password and that user has minimal rights on the Linux box. Mainly, it can only read data... For sure, nosudo
or other such advanced permissions.The backup files can even be created under
/home/backups
with a user such as root and thus can't be tempered bybackups
, only read for the transfer. That way you know that those files are safe.Final Step
Now it looks like you have a fully automated backup...
Well! Please make sure that the files look correct. Even, if you have time, attempt a restore. It's going to be manual, but hopefully you'll never need those backups. (I rarely need mine and I like it that way!)
Replication for Backing Up Systems
You may also be interested in a more advance topic: replication. This is where you create a VPS second instance and get all the data duplicated between both computers. I know of Hadoop, for example. However, I'm not so sure that it would work well between Linux & MS-Windows, hence the second VPS as a backup... Some database systems come with such replication, like Cassandra. PostgreSQL and MySQL also have replication mechanism that can be used for backing up your data. Those would work between a Linux VPS and MS-Windows. However, it probably requires your MS-Windows computer to be up and running at all time.
So, with Hadoop replicating your folders and setting your database with replication, you could also achieve your replication. It's just much more work to make it all work as expected... (and you have other potential security issues arising.)
Since it's a VPS you have access to everything and you can install all the software you need. Any solution of your choice can work, but setting up something like rsync would of been nice if you were to have a linux server to back it up to.
Since you deal with a Windows client, you could use something like Bacula. It is an Open Source Backup Software which does not require intervention from an admin once setup. Bacula supports Linux, UNIX, and Windows backup clients. Administrators and operators can configure the system via a command line console, GUI or web interface.
Have you tried FTP, that should do the job. Use vsftpd as the server and FileZilla client or file explorer's built in FTP client.
To install vsftpd in Ubuntu, run the following:
Note: The login is your Ubuntu login, you will start in your home directory where you can navigate to root directory.
FTP is a good option, But since you already have SSH access you can use SFTP too. If you are using a ssh-client like Bitvise on windows, Then you can easily get an SFTP window and copy any file you want from your VPS into any local folder on your windows client.
But FTP is the more standard option.
Also, There are other options. This link should help