<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>New Webmasters &#187; Server Maintenance</title>
	<atom:link href="http://newwebmasters.net/category/server-maintenance/feed/" rel="self" type="application/rss+xml" />
	<link>http://newwebmasters.net</link>
	<description>Build a Better Website</description>
	<lastBuildDate>Sun, 03 Jan 2010 23:12:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finally! A Web Server Backup Solution You Can Actually Use</title>
		<link>http://newwebmasters.net/server-maintenance/finally-a-web-server-backup-solution-you-can-actually-use/</link>
		<comments>http://newwebmasters.net/server-maintenance/finally-a-web-server-backup-solution-you-can-actually-use/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 21:13:30 +0000</pubDate>
		<dc:creator>corbyboy</dc:creator>
				<category><![CDATA[Server Maintenance]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Planning Issues]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://newwebmasters.net/?p=747</guid>
		<description><![CDATA[There are many backup solutions available for your website. But none of them seem to address the most common situation: backing up shared Linux hosting using a Windows computer. Let's solve that today.]]></description>
			<content:encoded><![CDATA[<p>
I have been looking at the <a href="http://newwebmasters.net/plan/why-backing-up-is-important/">issue of backups</a> quite a lot recently. I am going to jump straight into the problem that I have faced:
</p>
<p><strong>Most webmasters used shared hosting on Linux servers but want to backup their webserver to their Windows computer.</strong></p>
<p>
It sounds like a pretty simple problem to be solved, but unfortunately there are very few methods available to perform a backup in this situation. Most solutions you come across will happily give you instructions to create a compact, archived version of your site and then save it back on your web server. This is all well and good, but what do we do with these? If the server fails we will lose the backups too!
</p>
<p>
Likewise, there are plenty of solutions that work perfectly if you are backing up onto a local Linux installation, but most people are running Windows and want to get a local copy of the backup on their own PC. These are the people who this tutorial is aimed at.
</p>
<h2>Ensure You Have Everything You Need</h2>
<p>This tutorial is for people who wish to backup any particular path on their server. You need to have SSH access. You also need to be running Windows.</p>
<h2>Install Cygwin</h2>
<p>Cygwin is a program for Windows that emulates a Linux-like environment. It provides Windows users with a colllection of tools to perform various tasks commonly performed on Linux installations. This is the software we will be using. Visit <a href="http://www.cygwin.com/">www.cygwin.com</a> and download straight from the homepage.</p>
<p><img src="http://newwebmasters.net/wp-content/uploads/2009/06/cygwin-download.jpg" alt="Download Cygwin" title="Download Cygwin" width="750" height="439" /></p>
<p>Next, run the setup.exe file you just downloaded.</p>
<p>At the introduction screen, click <strong>next</strong> then select <strong>Install from Internet</strong> and click <strong>next</strong>.</p>
<p>On the next screen, choose a directory to install Cygwin. Make sure you choose a path that doesn&#8217;t contain any spaces. A good choice is C:\cygwin. Then click <strong>next</strong>. The next screen will ask you where to store the installation files. You can set this to the same directory you chose for installation on the previous screen. Then click <strong>next</strong>.</p>
<p>One more screen will appear for you to choose your internet connection method. The default choice of &#8220;Direct connection&#8221; is usually fine. Cygwin will download a list of mirrors. Choose one that is close to you and then click <strong>next</strong>. It will take a few seconds to download the list of files.</p>
<h3>Choose Elements to Install</h3>
<p>The next screen is a bit busy and might seem confusing, but it just lists every application that you can install in Cygwin. By default they are grouped by category. You can click + next to each category to view the individual applications.</p>
<p><img src="http://newwebmasters.net/wp-content/uploads/2009/06/cygwin-install.jpg" alt="Cygwin Installation Screen" title="Cygwin Installation Screen" width="750" height="451" /></p>
<p>Click the <strong>View</strong> button at the top right of the screen and the view will change from &#8220;Category&#8221; to &#8220;Full.&#8221; This will allow us to select the specific applications we want to install.</p>
<p>We need to be careful which applications we choose here. Some will be chosen by default. Choose the applications listed below by clicking on the word &#8220;Skip&#8221; for each one. The word skip will change to the version number to signify it will be installed. The applications are all listed alphabetically.</p>
<ul>
<li>rsync</li>
<li>openssh</li>
<li>openssl</li>
</ul>
<p>The program will automatically choose any other files that are required, so just accept anything else that Cygwin chooses for you. Click <strong>Next</strong> to start download.</p>
<p>You may have to wait several minutes while the files are downloaded and installed (see below).</p>
<p><img src="http://newwebmasters.net/wp-content/uploads/2009/06/install-progress.jpg" alt="Cygwin Installation Progress" title="Cygwin Installation Progress" width="750" height="121" /></p>
<p>Once installation has completed click <strong>Finish</strong>. We now have a working installation of Cygwin in which to perform our backup.</p>
<h2>Running the Backup File</h2>
<p>Cygwin has now installed the tools to perform our backup. This is what our backup script looks like. It assumes that you have installed Cygwin in c:\cygwin. Save it as backup.bat so it can be executed.</p>
<pre>
@echo off

C:
chdir c:\cygwin

echo set date format........................
echo ...
echo ...
echo ...
echo ...

rem get date, make if file name friendly
FOR /F "tokens=1-4 delims=/ " %%i in ('date/t') do set d=%%k-%%j-%%i

echo Running rsync........................
echo ...
echo ...
echo ...
echo ...
c:\cygwin\bin\rsync -aze c:\cygwin\bin\ssh username@example.com:/home/user/public_html "/cygdrive/d/bk/%d%"
</pre>
<p>So what does this script actually do? It connects to your server at example.com and backs up the public_html folder to the folder D:\bk. The folder name will be based on the date, for example D:\bk\2009-06-21.</p>
<p>Cygwin lists all your drives in a folder called <strong>/cygdrive</strong>. So the C: drive will be located in /cygdrive/c and the D: drive will be located in /cygdrive/d.</p>
<p>This is the line that you need to edit:</p>
<pre>c:\cygwin\bin\rsync -aze c:\cygwin\bin\ssh username@example.com:/home/user/public_html "/cygdrive/d/bk/%d%"</pre>
<ul>
<li><strong>c:\cygwin\bin\rsync</strong> is the path to rsync. This path is correct if you have installed Cygwin in C:\cygwin</li>
<li><strong>c:\cygwin\bin\ssh</strong> is the path to ssh.</li>
<li><strong>username@example.com:/home/user/public_html</strong> is your login to your SSH server and the path you wish to backup.</li>
<li><strong>&#8220;/cygdrive/d/bk/%d%&#8221;</strong> is the path where you want to save your backup. %d% refers to the date in the format YYYY-MM-DD. In this format the backup will be saved in D:\bk\2009-06-21.</li>
</ul>
<p>Edit all these variables as is necessary.</p>
<h2>Run Your Backup and Check Eveything Works</h2>
<p>Since you have saved the file as a backup.bat file, you can simply double-click it in Windows and it will execute. Ensure your backup directory exists and double-click backup.bat to execute it.</p>
<p><img src="http://newwebmasters.net/wp-content/uploads/2009/06/ssh-backup.jpg" alt="Rsync running in SSH" title="Rsync running in SSH" width="677" height="340" /></p>
<p style="clear:both">The way the script is setup, it will always ask you for your SSH password. It is possible to set up your server so SSH access is always granted.</p>
<p>You can use the Windows task manager to execute your backup regularly.</p>
<p>Let me know how you get on with it or if you run into any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://newwebmasters.net/server-maintenance/finally-a-web-server-backup-solution-you-can-actually-use/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
