The following article describes how to create and roll back a backup of a root server hosting on the shell or console.
The target is to backup the VIMP installation with all of its files and its database. Before an update of your installation you should also always make a backup of the complete system.
The backup creation includes two tasks:
In the following we assume that you are in the VIMP installation folder.
We save the database (MySQLdump):
mysqldump -u database_user -p --opt database_name > dumpfilename.sql
We save the files to an archive (backup.tar.gz):
tar cvzf backup.tar.gz --exclude=web/cache *
That's it. We just created an archive with all files and the database dump inside.
The archive can now be moved to another server or local machine via FTP or SFTP or you can move it to another folder on your webserver.
If you need to roll back the data, copy backup.tar.gz back into the VIMP installation folder first.
Extracting the backup:
tar xvzfp backup.tar.gz
If you are root, the 'p' option is not needed necessarily. Otherwise it maintains the file permissions and is very important, because we assume you don't want to set all permissions anew manually.
If the files shall belong to another user than perviously, use chown:
chown -R username:groupname*
With Debian it is:
chown -R www-data:www-data *
We import the database dump:
mysql -u database_user -p database_name < dumpfilename.sql
Of course you can also import the dump into any other database with other access data.