Skip to content

Backblaze B2 Command Line Tool

Shaun edited this page Jul 1, 2016 · 2 revisions

Configuring and Setting up b2 backups

Follow the Backblaze Command Line to configure b2.

For a quick install example, here's how I installed it on ubuntu:

cd /usr/local/sbin
sudo mkdir B2
sudo chown <yourname>: B2
git clone https://github.com/Backblaze/B2_Command_Line_Tool.git B2
cd B2/
sudo python setup.py install
b2 version
b2 authorize_account

If you get the following:

/usr/local/lib/python2.7/dist-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/requests-2.10.0-py2.7.egg/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning

then try the following:

sudo apt-get install python-openssl
sudo pip install requests[security]

You should set up auto-gitlab-backup to run as root under cron. So copy your b2 account info to the root home:

cp ~/.b2_account_info /root/

You can test by creating a bucket as root:

sudo b2 create_bucket gitlab-host-net-backup allPrivate

Test b2 with:

sudo b2 sync --keepDays 5 --replaceNewer /var/opt/gitlab/backups/ b2://gitlab-host-net-backup/
Clone this wiki locally