version=pmwiki-2.2.1 ordered=1 urlencoded=1 agent=Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081216 Ubuntu/8.04 (hardy) Firefox/2.0.0.19 author=Petko charset=ISO-8859-1 csum=enabled links ctime=1134693395 host=81.65.14.164 name=PmWiki.BackupAndRestore rev=30 targets=PmWiki.Uploads text=(:title Backup and Restore:)%0a(:Summary:background information and some basic backup and restore procedures:)%0a%0aThis page has some background information on making backups and explains some basic *nix backup and restore procedures.%0a%0a!! Introduction%0a%0aYour wiki installation contains some unique data in the following directories:%0a%0a local/ Local configuration scripts%0a cookbook/ Recipes obtained from the [[(Cookbook:)Cookbook]]%0a pub/ Publicly accessible files%0a wiki.d/ Wiki pages%0a uploads/ [[Uploads|Uploaded files]] (attachments)%0a%0aA good backup plan will include periodically archiving these directories — or at bare minimum [@local/@] and [@wiki.d/@]. Good practice dictates keeping your backup archives on a separate machine.%0a%0a!! Simple Backup and Restore (*nix)%0a%0aWhen it comes to backup, simpler is better. %0aSince the pmwiki distribution is very small (about 1/4 megabyte), it's simplest to just archive the distribution files along with the data.%0a%0a!!! Making a Backup Archive%0a%0aThe following *nix command, executed from the parent directory of your wiki's directory, will put a complete backup archive of your site in your home directory.%0a%0a-> [@%0atar -zcvf ~/wiki-backup-`date +%25Y%25m`.tar.gz wiki/%0a@]%0a%0a[[#restore]]%0a!!! Restoring the Backup Archive%0a%0a!!!! Simple Method%0a%0aYour site can be restored and running in under 30 seconds with%0a%0a-> [@%0atar -zxvf ~/wiki-backup-200512.tar.gz%0afind wiki/uploads/ -type d |xargs chmod 777%0afind wiki/wiki.d/ -type d |xargs chmod 777%0a@]%0a%0a!!!! A Slightly-More-Secure Method%0a%0aThe simple restore commands above will give you world-writable files and directories. You can avoid world-writable permissions by letting PmWiki create directories with the proper attributes (ownership and permissions) for you.%0a%0aStart with%0a%0a-> [@%0atar -zxvf ~/wiki-backup-200512.tar.gz%0arm -rf wiki/wiki.d%0arm -rf uploads%0achmod 2777 wiki/%0a@]%0a%0aNow upload a file in each group that had uploads. If your site doesn't have uploads, just visit your site once so the wiki.d/ directory will be created.%0a%0aFinish your installation with%0a%0a-> [@%0achmod 755 wiki/%0atar -zxvf ~/wiki-backup-200512.tar.gz%0a@]%0a%0a%0a!!! Details%0a%0aThe commands on this page assume your site is in a directory called "wiki/". The test backup was made in December, 2005 so it's named accordingly.%0a%0aYour site will only have an uploads/ directory if uploads are enabled.%0a%0aThe backup command uses a date stamp (YYYYMM) in the filename. If you automate the command via cron you'll wind up with monthly snapshots of your site. You can get a daily snapshot by appending %25d to the date command ([@`date +%25Y%25m%25d`@] will get you YYYYMMDD). Be wary of space limitations if you have a large uploads/ directory.%0a%0a%0a!! See Also%0a%0a* A [[http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/20317| thread]] [gmane.org] on the pmwiki-users mailing list.%0a* A [[(Cookbook:)Backup Pages]] recipe in the cookbook.%0a%0a!! Miscellaneous%0a%0a%0a!! Backup via FTP%0aDownload and install a ftp client like [[http://filezilla-project.org/download.php?type=client|Filezilla]]%0a%0a# Using the ftp client connect to the server where you host pmWiki using%0a## the IP address (ex: 123.234.56.67) or the ftp name (ex: ftp.myhost.com)%0a## supply your account name (ex: mylogin) and password (ex: myp4ssw0rd)%0a# Move to your pmWiki directory (ex: @@/usr/mylogin/web/wiki/@@ or @@/tahi/public_html/pmwiki@@ )%0a# Select the folder you want to backup as explained before (probably either only the data or the whole wiki directory)%0a** for data you will want to backup both the directories%0a*** @@wiki.d@@ for user page data%0a*** @@pmwikiuploads@@ (or @@uploads@@) for your attachments (uploads)%0a** for system you will want, at a minimum, to backup both the directories%0a*** @@local@@ for configuration data %0a*** @@pub@@ for local CSS and skins customisations%0a# Download them to a local folder%0a# Use [[http://www.7-zip.org/ | 7zip]] or a similar software to build an archive of this backup%0a%0aYou can also very easily sync your FTP directories with your hard disc via this command line:%0a-> [@ wget -nv -np -m ftp://user:password@ftp.yourhost.net/ @]%0a'-Download [[http://gnuwin32.sourceforge.net/packages/wget.htm | Wget for Windows]] (other systems normally have it installed).-'%0a time=1241736520 title=Backup and Restore