(edit 8/20/2012: Originally written for v1.5, this has been tested and works fine as of Gmvault v1.7-beta, so just change things accordingly and install away! I’ve updated the links below.)
I’ve been using getmail for over a year to backup my Gmail account. As far as I know, it’s been working, but it just grabs email over POP, dumps them into an mbox file, and that’s that. It’s a fairly basic procedure, but since it just blindly downloads emails, getmail doesn’t account for ones I’ve deleted, and I don’t know if it keeps any label information.
So along comes Gmvault, the new kid on the block with fancy restore features and multiple OS capability. Let’s give it a shot.
Python should be installed on a default Ubuntu machine, but let’s install a few other pre-requisites as well. I’m using Ubuntu 12.04 LTS (Precise Pangolin).
sudo apt-get install python python-setuptools
sudo easy_install -U distribute
Then download the source package for Gmvault:
tar xvzf gmvault-1.7-beta-src.tar.gz
sudo python setup.py install
The basic setup is about as simple as it comes:
gmvault sync email@example.com
The setup process will take you through an authentication process with your email account.
Since I ran the install on an Ubuntu headless server, it loaded the text-based w3m browser, which I was able to login to my account, but then was unable to approve Gmvault to access my email. Pressing ‘q’ quits the browser and you’ll be presented with with an OAuth link you can copy into a normal browser and authorize Gmvault that way. (Note: you can manage what apps can access your Google Account at any time)
Once Gmvault is given the okay, it’ll start churning away downloading emails. Give it a few minutes (or hours) to finish, and feel better knowing that your hoard of oh-so-important emails are now tucked away in yet another location.
There’s a few other parameters you can pass to the program, which will allow you to change the vault database location, provide a user/pass rather than the OAuth token, and to run custom synchronization of certain emails. Take a look at the in-depth documentation on Gmvault.
After running the initial sync, you can run the following command to run a quick sync (only the last 2 months are scanned):
gmvault sync --type quick firstname.lastname@example.org
Restoration of emails appears to be straightforward (although I haven’t tried it) and emails are stored in month folders as individual .eml.gz and .meta files. The gzipping appears to be fairly efficient, as the Gmvault database reports to be about 2/3rds the reported size of my Gmail inbox. Not bad at all!
Also–for the sake of completeness, a few days after I wrote this I found out about BaGoMa, which is another Python-based utility to backup your Gmail. Seems to follow a similar path as Gmvault, but I like Gmvault’s ability to use OAuth rather than have to provide my password each time.
So far, Gmvault appears to have a simple and easy to use product that fits my needs. Good work!
6 replies on “Gmvault: gmail backup (Ubuntu install and setup)”
Hi Jason, thanks for the straightforward instructions. It worked better with these instructions than with the official documentation! Now it is busy downloading the stuff. Nice!
I’d previouslt installed gmvault & used it. Suddenly it’s no longer found. Only reason that I can think of is having new version of Firefox installed under Ubuntu 32 bit Precise. Is that correct?
PS Your instructions worked fine.
John, I’m not sure how a Firefox update would have affected your gmvault install. You might check and see if the binary is still there (/usr/local/bin/gmvault is where mine is installed).
Jason, It’s there now. But it would be as I reinstalled it. I’ll have to see if this happens again: if so, I’ll check before reinstalling.
Jason, are you using a cron for this on an ongoing basis? if so, would you just run this as the command?
gmvault sync –type quick email@example.com
Yep. Monthly I do a