<?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>Hack Admin &#187; Backup</title>
	<atom:link href="http://www.hackadmin.com/category/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server</title>
		<link>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/</link>
		<comments>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:29:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[rsnapshot]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=224</guid>
		<description><![CDATA[Article by Aashish
How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server

Q. I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server<br />
</strong><br />
<strong>Q.</strong> I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly format. How do I configure my Red Hat / CentOS Linux server as remote backup or snapshot server? </p>
<p><span id="more-224"></span><br />
<strong>A.</strong> rsnapshot is easy, reliable and a good disaster recovery backup solution. It is a remote backup program that uses rsync to take backup snapshots of your filesystems. It uses hard links to save space on disk and offers following features:</p>
<p><strong>• Filesystem snapshot</strong> &#8211; for local or remote systems.</p>
<p><strong>• Database backup</strong> &#8211; MySQL backup</p>
<p><strong>• Secure</strong> &#8211; Traffic between remote backup server is always encrypted using openssh</p>
<p><strong>• Full backup</strong> &#8211; plus incremental</p>
<p><strong>• Easy to restore</strong> &#8211; Files can restored by the users who own them, without the root user getting involved.</p>
<p><strong>• Automated backup</strong> &#8211; Runs in background via cron.</p>
<p><strong>• Bandwidth friendly</strong> &#8211; rsync used to save bandwidth </p>
<p><strong>Sample setup</strong></p>
<p>• snapshot.example.com &#8211; HP box with RAID 6 configured with Red Hat / CentOS Linux ac as backup server for other clients.</p>
<p>• DNS ns1.example.com &#8211; Red Hat server act as primary name server.</p>
<p>• DNS ns2.example.com &#8211; Red Hat server act as secondary name server.</p>
<p>• www.example.com &#8211; Red Hat running Apache web server.</p>
<p>• mysql.example.com &#8211; Red Hat mysql server.</p>
<p><strong>Install rsnapshot</strong></p>
<p>Login to snapshot.example.com. Download rsnapshot rpm file, enter: WARNING! These examples only works on Red hat / CentOS / Suse / RHEL / Fedora Linux. See Debian / Ubuntu Linux backup server instructions here.</p>
<p># cd /tmp</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p>Verify rpm file for integrity, enter</p>
<p># md5sum -c rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p><strong>Sample output:</strong><br />
rsnapshot-1.3.0-1.noarch.rpm: OK<br />
Install rsnapshot, enter:</p>
<p># rpm -ivh rsnapshot-1.3.0-1.noarch.rpm<br />
Sample output:<br />
Preparing&#8230; ########################################### [100%]<br />
1:rsnapshot ########################################### [100%]</p>
<p><strong>Configure rsnapshot</strong></p>
<p>You need to perform following steps</p>
<p>Step # 1: Configure passwordless login</p>
<p>To perform remote backup you need to setup passwordless login using openssh. Create ssh rsa key and upload them to all servers using scp (note you are overwriting ~/ssh/authorized_keys2 files).You need to type following commands on snapshot.example.com server:</p>
<p># ssh-keygen -t rsa</p>
<p># scp .ssh/id_rsa.pub root@ns1.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@ns2.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@www.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@mysql.example.com:.ssh/authorized_keys2</p>
<p>Step # 2: Configure rsnapshot</p>
<p>The default configuration file is located at /etc/rsnapshot.conf. Open configuration file using a text editor, enter:</p>
<p># vi /etc/rsnapshot.conf</p>
<p><strong>Configuration rules</strong></p>
<p>You must follow two configuration rules:</p>
<p>• rsnapshot config file requires tabs between elements.</p>
<p>• All directories require a trailing slash. For example, /home/ is correct way to specify directory, but /home is wrong.</p>
<p>First, specify root directory to store all snapshots such as /snapshots/ or /dynvol/snapshot/ as per your RAID setup, enter:</p>
<p>snapshot_root /raiddisk/snapshots/</p>
<p>You must separate snapshot_root and /raiddisk/snapshots/ by a [tab] key i.e. type snapshot_root hit [tab] key once and type /raiddisk/snapshots/.</p>
<p><strong>Define snapshot intervals</strong></p>
<p>You need to specify backup intervals i.e. specify hourly, daily, weekly and monthly intervals:</p>
<p>interval hourly 6</p>
<p>interval daily 7</p>
<p>interval weekly 4</p>
<p>interval monthly 3</p>
<p>The line &#8220;interval hourly 6&#8243; means 6 hourly backups a day. Feel free to adapt configuration as per your backup requirements and snapshot frequency.</p>
<p><strong>Remote backup directories</strong></p>
<p>To backup /var/named/ and /etc/ directory from ns1.example.com and ns2.example.com, enter:</p>
<p>backup root@ns1.example.com:/etc/ ns1.example.com/</p>
<p>backup root@ns1.example.com:/var/named/ ns1.example.com/</p>
<p>backup root@ns2.example.com:/etc/ ns2.example.com/</p>
<p>backup root@ns2.example.com:/var/named/ ns2.example.com/</p>
<p>To backup /var/www/, /var/log/httpd/ and /etc/ directory from www.example.com, enter</p>
<p>backup root@www.example.com:/var/www/ www.example.com/</p>
<p>backup root@www.example.com:/etc/ www.example.com/</p>
<p>backup root@www.example.com:/var/log/httpd/ www.example.com/</p>
<p>To backup mysql database files stored at /var/lib/mysql/, enter:</p>
<p>backup root@mysql.example.com:/var/lib/mysql/ mysql.example.com/dbdump/Save and close the file. To test your configuration, enter:</p>
<p># rsnapshot configtest</p>
<p>Sample output:</p>
<p>Syntax OK</p>
<p><strong>Schedule cron job</strong></p>
<p>Create /etc/cron.d/rsnapshot cron file. Following values used correspond to the examples in<br />
#vim /etc/rsnapshot.conf.</p>
<p>0 */4 * * * /usr/bin/rsnapshot hourly</p>
<p>50 23 * * * /usr/bin/rsnapshot daily</p>
<p>40 23 * * 6 /usr/bin/rsnapshot weekly</p>
<p>30 23 1 * * /usr/bin/rsnapshot monthly</p>
<p>Save and close the file. Now rsnapshot will work as follows to backup files from remote boxes:</p>
<p>1. 6 hourly backups a day (once every 4 hours, at 0,4,8,12,16,20)</p>
<p>2. 1 daily backup every day, at 11:50PM</p>
<p>3. 1 weekly backup every week, at 11:40PM, on Saturdays (6th day of week)</p>
<p>4. 1 monthly backup every month, at 11:30PM on the 1st day of the month<br />
<strong><br />
How do I see backups?</strong></p>
<p>To see backup change directory to</p>
<p># cd /raiddisk/snapshots/</p>
<p># ls -l</p>
<p>Sample output:<br />
drwxr-xr-x 4 root root 4096 2008-07-04 06:04 daily.0<br />
drwxr-xr-x 4 root root 4096 2008-07-03 06:04 daily.1<br />
drwxr-xr-x 4 root root 4096 2008-07-02 06:03 daily.2<br />
drwxr-xr-x 4 root root 4096 2008-07-01 06:02 daily.3<br />
drwxr-xr-x 4 root root 4096 2008-06-30 06:02 daily.4<br />
drwxr-xr-x 4 root root 4096 2008-06-29 06:05 daily.5<br />
drwxr-xr-x 4 root root 4096 2008-06-28 06:04 daily.6<br />
drwxr-xr-x 4 root root 4096 2008-07-05 18:05 hourly.0<br />
drwxr-xr-x 4 root root 4096 2008-07-05 15:06 hourly.1<br />
drwxr-xr-x 4 root root 4096 2008-07-05 12:06 hourly.2<br />
drwxr-xr-x 4 root root 4096 2008-07-05 09:05 hourly.3<br />
drwxr-xr-x 4 root root 4096 2008-07-05 06:04 hourly.4<br />
drwxr-xr-x 4 root root 4096 2008-07-05 03:04 hourly.5<br />
drwxr-xr-x 4 root root 4096 2008-07-05 00:05 hourly.6<br />
drwxr-xr-x 4 root root 4096 2008-07-04 21:05 hourly.7<br />
drwxr-xr-x 4 root root 4096 2008-06-22 06:04 weekly.0<br />
drwxr-xr-x 4 root root 4096 2008-06-15 09:05 weekly.1<br />
drwxr-xr-x 4 root root 4096 2008-06-08 06:04 weekly.2</p>
<p><strong>How do I restore backup?</strong></p>
<p>Let us say you would like to restore a backup for www.example.com. Type the command as follows (select day and date from ls -l output):</p>
<p># cd /raiddisk/snapshots/<br />
# ls -l</p>
<p># cd hourly.0/www.example.com/</p>
<p># scp -r var/www/ root@www.example.com:/var/www/</p>
<p># scp -r etc/httpd/ root@www.example.com:/etc/httpd/</p>
<p><strong>How do I exclude files from backup?</strong></p>
<p>To exclude files from backup, open rsnapshot.conf file and add following line:</p>
<p>exclude_file /etc/rsnapshot.exclude.www.example.com</p>
<p>Create /etc/rsnapshot.exclude.www.example.com as follows:</p>
<p>/var/www/tmp/</p>
<p>/var/www/*.cache</p>
<p>That&#8217;s It!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon S3 backup Tutorial -via Khaled</title>
		<link>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/</link>
		<comments>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 22:54:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=198</guid>
		<description><![CDATA[To interact with amazon S3, we have many languages we can use as well as python. I chose python because it's a scripting language.  That means we don't need to compile and we don't need a virtual machine to run it, only an interpreter is needed.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>To interact with amazon S3, we have many languages we can use as well as python.  I chose python because it&#8217;s a scripting language.  That means we don&#8217;t need to compile and we don&#8217;t need a virtual machine to run it, only an interpreter is needed.</p>
<p>	There is some ready tools to interact with amazon S3 I found S3cmd it&#8217;s made with python and there is many methods within.</p>
<p><span id="more-198"></span><br />
Installing S3cmd   (nb: commands are in red color)</p>
<p>Its better to be root to have all permissions   Laptop:~$ sudo -i</p>
<p>Take the zip file and copy it somewhere for example /home/Your_Directory/  </p>
<p>1.To copy  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;     Laptop:~# cp s3cmd-0.9.9.91 /home/Your_Directory</p>
<p>2. Decompress the file.	&#8212;&#8212;&#8212;&#8212;&#8212;-  Laptop:~# unzip s3cmd.zip</p>
<p>3. Move to s3cmd folder	.&#8212;&#8212;&#8212;&#8212;&#8212;	Laptop:~# cd s3cmd-0.9.9.91</p>
<p>4. Change setup.py mod to can execute it.    Laptop:~/s3cmd-0.9.9.91# chmod +x setup.py </p>
<p>5. Run the setup file with this command.      Laptop:~/s3cmd-0.9.9.91# ./setup.py                                  </p>
<p>6. During the installation enter your 	access key and secret one, and choose secured connection.</p>
<p>	Now s3cmd is installed and your connection with s3 account is set, so you can transfer files to and from s3 account there is many commands you can use to can use them you should be in s3cmd folder, I verified most of the code and it uses methods provided by amazon s3 developers.</p>
<p>	The command that allows you to transfer from your server (linux) to amazon s3 is :</p>
<p>s3cmd-0.9.9.91#./s3cmd put Local_File s3://BUCKET_Name/Other_Files_In_Bucket</p>
<p>But this command will transfer “Local_File” to the bucket so if we have another new file within and we use the same command, the whole “Local_File” would be transferred too, so we loose in data transfer.</p>
<p>	BUT if we use a sync command we can synchronize a local file with a remote one, it means that if we have a local folder and we add files in it step by step this command allows us to transfer only missing files to the remote file,  this is how we minimize data transfer, so for example everyday we have a new tar.gz file added to our local file and our backup would be done everyday, </p>
<p>The command is :<br />
3cmd-0.9.9.91# ./s3cmd sync /home/Your_Directory/local_file/  s3://BUCKET_Name/Remote_File</p>
<p>Every time we run this command it copies only missing files.</p>
<p>Automation of our transfer with sync command:</p>
<p>	In linux OS we can automate execution of commands by adding them to a special file which has a specific (easy) syntax.<br />
To access to this file we use this command  &#8212;&#8212;&#8212;   3cmd-0.9.9.91# crontab -e</p>
<p>Our file is open now, we can insert any command to be executed at any time or day or month.</p>
<p>A sample line is so &#8212;&#8212;&#8212;&#8212;&#8212;-   * * * * * Command_to_execute</p>
<p>if we want to run any linux command for example at 3:59 PM we edit our line as follow<br />
59 15 * * *  Command_to_run</p>
<p>	Suppose that we have our tar.gz files already in a Local_File and we want to transfer them to the Remote_File with sync command everyday at 3:00 am, the line would be:</p>
<p>0 3 * * * Path_Where_s3cmd_Folder_is/./s3cmd  sync  /home/Your-Directory/Local_File/ s3://BUCKET/Remote_File/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/12/amazon-s3-backup-tutorial-via-khaled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

