MMNCS.COM
  • Web
    • WordPress
    • Joomla
    • Drupal
  • Tips & Tricks
    • Youtube
    • WordPress
    • Windows
    • Web
    • Twitter
    • Linux Ubuntu
    • Google
    • Facebook
    • Drupal
    • Developer
    • Designer
    • Apple
  • Tech News
    • Windows Phone
    • Servers
    • Search Engines
    • Nokia
    • Microsoft
    • iPhone
    • Google
    • Facebook
    • Browsers
    • Apple
  • Social Media
    • Youtube
    • Yahoo
    • Twitter
    • Google+
    • Facebook
  • Server
    • Web Server
      • NGINX
      • Apache Web Server
    • Ubuntu
    • Security
      • Access Control
    • Mail Server
    • Hosting
    • FTP Server
    • Firewall
    • Database
      • MySQL
    • Backup
  • SEO
    • Yahoo Search
    • Google Search
    • Google AdSense
    • Bing
  • Off-Topic
    • Weird
    • Music
    • Fun
    • Documentaries
  • Mobile
    • Windows Phone 7
    • iPhone
    • Android
  • Google
    • Google Translate
    • Google Plus
    • Google PageRank
    • Google Adwords
    • AdSense
  • Design & Dev
    • Webdevelopment
    • Version Control
      • Git Version Control
    • Programming
    • PHP
    • JavaScript
    • HTML
    • Development Environment
    • CSS

Related

  1. How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin – The fast Version Control System
  2. The easy way to install LAMP Server (LINUX-APACHE-MYSQL-PHP) + PhpMyAdmin
  3. How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 or 10.04 with Windows clients using MSysGit
  • Share on Tumblr

How to Install and Setup a backup system on Linux Unbuntu 11.04 and Debian based systems using Tartarus

by MMNCS on June 28th, 2011, updated November 3, 2011
Backup System Tartarus Linux Server

This guide shows you how to install and setup a backup system with incremental backups on Linux Debian based system using Tartarus with your own FTP Server. This guide also contains a bash script which automates the whole process of installing and configuring Tartarus.
 
 
Tartarus is a software that provides a nice wrapper around basic Unix tools such as tar, find and curl (well, that’s not that basic) to provide a seamless backup solution, aimed at automatic gathering and backup. It has the ability to do full as well as incremental backups and is published by Stefan Tomanek under the rules of the GPL.
 
Instead of relying on single usage backup scripts or complicated command lines, “tartarus” reads its configuration from easily managable configuration files. It can store gathered data in regular files, or upload the backup directly (on the fly) to an FTP server. For more specific usage scenarios, custom methods can also be defined within the config file.
 
 
Click like to add us to your Facebook News Feed


 
Installation
Debian users can install the program also easily use the packaging system and keep it current by adding the following line to your APT configuration. Than is create a file called /etc/apt/sources.list.d/tartarus.list and add the following line:

deb http://wertarbyte.de/apt/ ./

 

Import the GnuPG key with which the repository is signed, and to install the program

wget -O /etc/apt/sources.list.d/wertarbyte.list http://wertarbyte.de/apt/wertarbyte-apt.list
wget -O - http://wertarbyte.de/apt/software-key.gpg | apt-key add -
apt-get update
apt-get install tartarus

 
 
The script uses a variety of classic Unix tools using the package management – if not already done – Install the following:

apt-get install tar bzip2 lvm2 gnupg curl

 
 

Configuration
Tartarus reads its configuration profile files that are stored in the / etc / tartarus. These are shell scripts that are processed by the backup process, so it is also possible to include on the command “source” other configuration files in a profile. This can be exploited to store generic settings for all profiles backup central
 
Create tartarus general config:

nano /etc/tartarus/generic.inc

 
 
Edit the settings in the config:

# / Etc / tartarus / generic.inc
# Generic settings for the backup
# Storage method
STORAGE_METHOD = "FTP"

# Address of the FTP server
STORAGE_FTP_SERVER = "yourftpserver.com"

# FTP access
STORAGE_FTP_USER = "your ftp user account"
STORAGE_FTP_PASSWORD = "users password"

#Compression method
COMPRESSION_METHOD="bzip2"

# Backup data encrypt symmetrically
ENCRYPT_SYMMETRICALLY = "yes"

# Password from / etc / tartarus / backup.sec read
ENCRYPT_PASSPHRASE_FILE = "/etc/tartarus/backup.sec"

# While the backup was not
# File system limits beyond
STAY_IN_FILESYSTEM = "yes"

# Helper script Charon which removes stored
# backups exceeding a specific age and is
# included in the tartarus distribution package.
# Hook in Charon

TARTARUS_POST_PROCESS_HOOK() {
# pass configuration variables to charon
# transmit the password through stdin to hide it from "ps ax"
local CHARON="/usr/sbin/charon.ftp"
local MAX_AGE_IN_DAYS="7"
echo -n "$STORAGE_FTP_PASSWORD" | $CHARON \
--host      "$STORAGE_FTP_SERVER"
--user      "$STORAGE_FTP_USER" -- readpassword \
--maxage  "$MAX_AGE_IN_DAYS" \
--dir         "$STORAGE_FTP_DIR" --profile    "$NAME"
}

# Logging to syslog

TARTARUS_DEBUG_HOOK() {
echo $DEBUGMSG | logger
}

 
Note*: In the end of the generic.inc configuration file I have added a post process hook. This hook is run after the backup has been carried out and delete backups which are older than 7 days. This is a nice feature so you don’t waste your storage with old backups.
 
 
Create a file with your pass phrase. You can create a pass phrase by using the program pwgen or choose your own. Add to the following file.

nano /etc/tartarus/backup.sec

 
 
Backup
Create a backup operation: A simple profile for the Safety of the root file system (/) might be:
 
Create backup config file:

nano /etc/tartarus/root.conf

 
Use these settings

# Read main config
source /etc/tartarus/generic.inc

# Profile name
NAME="root"

# What to backup
DIRECTORY="/"

# To exlude
EXCLUDE="/tmp/ /proc/ /sys/ /var/tmp/ /var/run/"

# No LVM snapshot
CREATE_LVM_SNAPSHOT="no"

INCREMENTAL_TIMESTAMP_FILE="/var/spool/tartarus/timestamps/root"

 

Do your fist backup:

tartarus /etc/tartarus/root.conf

 
 

Incremental backups
After a full backup you can start incremental backups. Incremental backups saves only the changes since the last full backup. Tartarus creates marker files to determine the exact date of the last backup. To perform incremental backups, you must first create a directory that contains these files:

mkdir -p /var/spool/tartarus/timestamps/root

 

After each successful backup the script updates the file. To perform an incremental backup, you start Tartarus incremental with the additional parameter “-i”. So to make an incremental backup you would write:

tartarus -i /etc/tartarus/root.conf

 

Automatic backup
The best solution is if you don’t have to think about backup and it is done automatically. It is there for a good idea to create a script to run your different backups. Create a shell script and place it in your favorite bin location. Here I have added it to /usr/local/bin

nano /usr/local/bin/tartarus_backup.sh

 

Here is the contents of the shell script. This runs the backup for the profile you choose to run it with. That is for our example tartarus_backup.sh # root. Add this to the file:

#!/bin/sh
# /usr/local/bin/tartarus_backup.sh
# Run all backup profile found in /etc/tartarus/ and pass
# command line arguments on to tartarus (e.g. -i)
for profile in /etc/tartarus/*.conf; do
/usr/sbin/tartarus $* "$profile"
done

 
 
Make the script executable:

chmod u+x tartarus_backup.sh

 
Now you can run the full backup script by writing and if the shell script is in your PATH you can leave that out.

/usr/local/bin/tartarus_backup.sh # root

 

And to run incremental backup:

/usr/local/bin/tartarus_backup.sh -i # root

 

Now add the backup task to your crontab. You edit the crontab by writing crontab -e in the prompt. Here is an example on full backup every Sunday and the other days incremental backups.

PATH=/bin/:/sbin/:/usr/bin/:/usr/sbin/:/usr/local/sbin/:/usr/local/bin
# m   h   dom   mon   dow      command
0    3   *      *     1-6      tartarus_backup.sh -i # root
0    3   *      *     0        tartarus_backup.sh # root

 

Note*: If you have databases on your server it is a good idea to backup these to the file system. Then they are automatically saved to your backup store when running tartarus backup. Here is a guide on how to backup your MySQL databases:
How to backup your MySQL databases automatically with the script AutoMySQLBackup
 
 

Recovery

Since Tartarus is based on simple Unix utilities, a backup is very easy to restore from the rescue system. To unpack the archive in the directory /mnt/restore you do the following:

 

mkdir /mnt/restore

curl ftp://USER:PASS@YOURSERVER/DIR/FILE | gpg --decrypt | tar xpvj -C /mnt/restore

 

Setup Tartarus Bash Script

Here is a script which automates the whole process of installing and configure Tartarus:

setuptartarus.sh

#!/bin/bash
# Add Tartarus to your source list
echo -e "\n\n# Tartarus" >> /etc/apt/sources.list
echo "deb http://wertarbyte.de/apt/ ./" >> /etc/apt/sources.list

# Import the GnuPG key with which the repository is signed, and to install the program
wget -O /etc/apt/sources.list.d/wertarbyte.list http://wertarbyte.de/apt/wertarbyte-apt.list
wget -O - http://wertarbyte.de/apt/software-key.gpg | apt-key add -
apt-get update
apt-get install tartarus

# The script uses a variety of classic Unix tools using the package management – if not already done – Install the following
apt-get install tar bzip2 lvm2 gnupg curl

# Create Tartarus dir
mkdir /etc/tartarus/

# Create config file
echo "Enter FTP server address and dir:"
read ftp
echo "Enter FTP user:"
read usr
echo "Enter FTP password:"
read -s pwd

echo "# File: etc/tartarus/generic.inc
# Modified

# / Etc / tartarus / generic.inc
# Generic settings for the backup
# Storage method
STORAGE_METHOD=\"FTP\"

# Address of the FTP server
STORAGE_FTP_SERVER=\"$ftp\"

# FTP access
STORAGE_FTP_USER=\"$usr\"
STORAGE_FTP_PASSWORD=\"$pwd\"

#Compression method
COMPRESSION_METHOD=\"bzip2\"

# Backup data encrypt symmetrically
ENCRYPT_SYMMETRICALLY=\"yes\"

# Password from / etc / tartarus / backup.sec read
ENCRYPT_PASSPHRASE_FILE=\"/etc/tartarus/backup.sec\"

# While the backup was not
# File system limits beyond
STAY_IN_FILESYSTEM=\"yes\"

# Helper script Charon which removes stored
# backups exceeding a specific age and is
# included in the tartarus distribution package.
# Hook in Charon

TARTARUS_POST_PROCESS_HOOK() {
# pass configuration variables to charon
# transmit the password through stdin to hide it from "
ps ax"
local CHARON=\"/usr/sbin/charon.ftp\"
local MAX_AGE_IN_DAYS=\"7\"
echo -n \"\$STORAGE_FTP_PASSWORD\" | \$CHARON \\
--host \"\$STORAGE_FTP_SERVER\" \\
--user \"\$STORAGE_FTP_USER\" --readpassword \\
--maxage \"\$MAX_AGE_IN_DAYS\" \\
--dir \"\$STORAGE_FTP_DIR\" --profile \"\$NAME\"
}

# Logging to syslog

TARTARUS_DEBUG_HOOK() {
echo \$DEBUGMSG | logger
}"
> /etc/tartarus/generic.inc

# Create root configuration
echo "# Read main config
source /etc/tartarus/generic.inc

# Profile name
NAME=\"root\"

# What to backup
DIRECTORY=\"/\"

# To exlude
EXCLUDE=\"/tmp/ /proc/ /sys/ /var/tmp/ /var/run/\"

# No LVM snapshot
CREATE_LVM_SNAPSHOT=\"no\"

INCREMENTAL_TIMESTAMP_FILE=\"/var/spool/tartarus/timestamps/root\""
> /etc/tartarus/root.conf

 

If there is a typo in the guide or you have a better solution please post it as comment.

 

Btw. if you like the post you know what to do ; )

You may be interested in

  1. How to backup your MySQL databases automatically with the AutoMySQLBackup script on Linux Ubuntu 11.04 and Debian based systems
  2. How to install and setup php development environment using Eclipse, LAMP and xDebug on Linux Ubuntu 10.04 & 11.04 [Developer]
  3. How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 or 10.04 with Windows clients using MSysGit
  4. The easy way to install LAMP Server (LINUX-APACHE-MYSQL-PHP) + PhpMyAdmin
  5. How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin – The fast Version Control System

support and subscribe to the site

Follow @mmncs
Posted in Backup, Hosting, Security, Ubuntu Tags: 2011, Backup Data Solution, configuration, Dedicated Server, Education, ftp server setup, GnuPG, Linux Ubuntu 11.04, Online Learning, Restore data, Server, Server setup, Setup, system backup, System Recovery Solution, Tartarus, Tutorial, VPS
« How to install and Setup GIT on Windows 7 using either MSysGit or Cygwin – The fast Version Control System
How to setup Virtual Hosts on your Linux Ubuntu 10.04 or 11.04 Apache Webserver »


Comments

You can leave a response, or trackback from your own site.
  1. 11-5-2011
    li

    Linux backups don’t have to a pain. A thoughtful backup cron will work for months!

    Reply
  2. 9-7-2011
    rsettiveadia

    Execellent solution for backup of files. Subscribing. Thanks

    Reply
  3. 9-7-2011
    Volstoij

    Solid solution. Thanks

    Reply
  4. 11-7-2011
    Rangitsch

    Thanks for you contribution. This is a backup solution for my needs. Like the site, thumbs up.

    Reply
  5. 26-1-2012
    scavenger

    nice job. i am using it. still some little problems …

    where
    –host “$STORAGE_FTP_SERVER”
    change to
    –host “$STORAGE_FTP_SERVER” \

    and another one…

    where
    mkdir -p /var/spool/tartarus/timestamps/root
    it gives a error, and you dont need a directory there so change to:
    mkdir -p /var/spool/tartarus/timestamps

    Reply

Leave a Reply

Click here to cancel reply.

Trackbacks & pingbacks

  1. 28-4-2011
    Need Help (Linux Backup) - Linux / UNIX Forum says: [...] would recommend Tartarus nice and simple solutions for backups You can checkout my guide on: How to Install and Setup a backup system on Linux Debian based systems using Tartarus | MMNCS This guide shows you how to install and setup a backup system with incremental backups on Linux [...]
  2. 8-7-2011
    How to backup your MySQL databases automatically with the script AutoMySQLBackup | MMNCS says: [...] After backup of databases it is highly recommended to backup files to an external storage. See this guide for more information: How to Install and Setup a backup system on Linux Unbuntu 11.04 and Debian based systems using Tarta... [...]
  3. 19-7-2011
    Setup Openssh-sftp-server on Synology NAS and connect using sshfs from your Linux Ubuntu Web Server | MMNCS says: [...] See also how to use Tartarus to backup your Webserver: How to Install and Setup a backup system on Linux Unbuntu 11.04 and Debian based systems using Tarta... [...]
  4. 21-7-2011
    How to Install and Setup a backup system on Linux Debian based … | Linux Affinity says: [...] here to see the original: How to Install and Setup a backup system on Linux Debian based … Posted in: How To's ADD [...]
  5. 27-10-2011
    wehostia.com says: wehostia.com...[...]How to Install and Setup a backup system on Linux Debian based systems using Tartarus | MMNCS.COM[...]...

Search terms for this article

  • tartarus backup google drive,
  • tartarus backup mysql t,
  • how to full backup root in debian,
  • how to recover /var/run/console +ubuntu,
  • incremental data backup using crontab in linux,
  • setup a linux backup server,
  • backup eines debian servers,
  • tartarus incremental backup only if full,
  • example of bash script central back up system ,
  • linux git based backup ,
  • debian webbased backup system,
  • linux sh read config file depending server,
  • debian how to backup data to ftp server,
  • backup no linux debian,
  • tartarus database incremental backup,
  • what files to backup +ubuntu,
  • lamp debian automatic backups,
  • debian auto mysql backup,
  • debian backup via ftp,
  • tartarus_post_process_hook,
  • backup unix ftp mail,
  • debian backup,
  • debian+backup+configuration,
  • debian backup system 2011,
  • how to set system, database, and backup server in linux debian,
  • linux tartarus incremental,
  • tartarus storage method,
  • debian incremental backup tools,
  • debian backup via ftp,
  • set up a backup system with git,
  • Subscribe

    Find MMNCS.COM on Facebook, about guides, tutorials and learning within webdevelopment, drupal, MySQL, PHP, WordPress, SEO...
    Follow MMNCS.COM on Twitter and get the latest updates
    Follow @mmncs
    Subscribe to MMNCS.COM newsletter, about guides, tutorials and learning within webdevelopment, drupal, MySQL, PHP, WordPress, Programming, Technology, SEO...
  • The Best technology news guides tips tricks on the Internet
  • best online art gallery, paintings, illustrations, fine art photography
  • Services

    Check your Google PageRank checker optimize seo serp page rank
    Take a picture of any website, WordPress Screenshot demo
  • Latest

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    December 30th, 2011

    Husbands and wives in the United Kingdom headed for divorce are increasingly citing Facebook in thei[...]

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    December 30th, 2011

    Here's another awesome application for the Nokia Lumia 800 and other Windows Phones. Skyscanner allo[...]

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    December 29th, 2011

    Rumor has it that the one thing that is notoriously missing (well, one of the things) from any Wind[...]

    Why I’m Replacing My iPhone With Nokia Lumia 800 And Why Android Is No Option

    Why I’m Replacing My iPhone With Nokia Lumia 800 And Why Android Is No Option

    December 7th, 2011

    Spoiler alert: This article is about how great the new Nokia Lumia 800 is, so if you are an iPho[...]

    Apple iPhone 4S Battery Drain Is Starting To Become A Serious Issue [iOs 5]

    Apple iPhone 4S Battery Drain Is Starting To Become A Serious Issue [iOs 5]

    November 29th, 2011

    Waiting on the next expected fix from Apple, iPhone 4S users complaining of rapid battery drain are [...]

  • musicfordriving com music for driving underground experimental electronic electronica dj rock jazz upcomming interesting music hot list hype
  • Selected

    Bill Gurley; Too Many Start-Ups Chase Too Little Cash

    Bill Gurley; Too Many Start-Ups Chase Too Little Cash

    November 14th, 2011

    Venture capitalist Bill Gurley has noticed something new this autumn: a big jump in the number of wh[...]

    The Best Programming Contest Ever Made – The AI Challenge Ants 2011 [Developer]

    The Best Programming Contest Ever Made - The AI Challenge Ants 2011 [Developer]

    October 30th, 2011

    The best programming contest ever made! Well that is what they state. The AI Challenge Ants 2011 is [...]

    Take A Picture Of Any Website [WordPress Screenshot Demo]

    Take A Picture Of Any Website [WordPress Screenshot Demo]

    October 28th, 2011

    Take a picture of any website. Just enter the website address in the form and press the button "Take[...]

    Optimize Your Time And Write Better CSS With {less} – [CSS Stylesheets]

    Optimize Your Time And Write Better CSS With {less} - [CSS Stylesheets]

    October 23rd, 2011

    If you think parts of CSS is repetitive, tedious, and … well, very boring. Have a look here. LESS [...]

    Call Your Friends For Free –  Cut The Expensive Voice And Text Plans To The Bare Minimum [Mobile Apps]

    Call Your Friends For Free - Cut The Expensive Voice And Text Plans To The Bare Minimum [Mobile Apps]

    October 14th, 2011

    After been using Viber for some time now. We highly recommend this mobile application for all smartp[...]

  • News

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    Facebook Helps Breakup on One-Third of Marriages in the U.K.

    December 30th, 2011

    Husbands and wives in the United Kingdom headed for divorce[...]

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    Nokia Lumia 800 Demo of Skyscanner. Flight Deals Search for Windows Phone

    December 30th, 2011

    Here's another awesome application for the Nokia Lumia 800 and[...]

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    Nokia Lumia, Samsung, HTC rumored to announce LTE Windows Phone smartphones at CES

    December 29th, 2011

    Rumor has it that the one thing that is notoriously missing[...]

  • Social Media

    Solved: Facebook XFBML Like Button Bug Creates a Vertical Scroll-Bar [Web Developer]

    Solved: Facebook XFBML Like Button Bug Creates a Vertical Scroll-Bar [Web Developer]

    September 16th, 2011

    After been doing a lot of work on the site I noticed when testing in IE8 and Firefox 3.6.x that I wa[...]

    Add a Cool Google Plus Profile Add to Circles Widget to Your Website [Google Plus]

    Add a Cool Google Plus Profile Add to Circles Widget to Your Website [Google Plus]

    August 11th, 2011

    Google Plus has created a very simple widget to embed your Google Plus profile on websites. This wid[...]

    How To Export All Your Facebook Friends To Google+ Using Yahoo Mail [Google+]

    How To Export All Your Facebook Friends To Google+ Using Yahoo Mail [Google+]

    August 8th, 2011

    Since the popular Chrome extension Facebook Friends Exporter got blocked we needed another way of ge[...]

  • Google

    Check Your Google Page Rank Here – Updated To Use The New Google PageRank Query URL

    Check Your Google Page Rank Here - Updated To Use The New Google PageRank Query URL

    October 8th, 2011

    Check PAGE RANK of Web site pages Instantly This is a free service to check Google™ page rank ins[...]

    Add a Simple Google Translate DropDown Box To Your Web Site [Tips & Tricks]

    Add a Simple Google Translate DropDown Box To Your Web Site [Tips & Tricks]

    September 6th, 2011

    Google Translate is the best free online translation service today and I often wonder why I rarely s[...]

    Google Closes Down 10 Mayor Business Areas [Tech News]

    Google Closes Down 10 Mayor Business Areas [Tech News]

    September 5th, 2011

    Google closes down 10 business areas in which the company itself calls "autumn-cleaning."The cle[...]

  • Home
  • About
  • Contact
  • Wollawonka
Copyright © MMNCS.COM is a site aimed at web developers, system engineers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites. We cover Open Source recommendations, Linux Server guides, PHP, HTML, CSS, Drupal & WordPress Tutorials, Guides, Tips & Technology News.