以下のVagrantfileを使用して、BorgBackupをインストールした仮想マシンを構築する事ができます。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.6"
config.vm.hostname = "db96borgbackup"
config.vm.network "public_network", ip:"192.168.1.103", :netmask => "255.255.255.0"
config.vm.network "private_network", ip: "192.168.55.103", :netmask => "255.255.255.0"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db96borgbackup"
vbox.gui = true
vbox.cpus = 2
vbox.memory = 2048
end
config.vm.provision "shell", inline: <<-SHELL
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get -y install task-japanese gawk
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
update-locale LANG=ja_JP.UTF-8
localectl set-locale LANG=ja_JP.UTF-8
localectl set-keymap jp106
timedatectl set-timezone Asia/Tokyo
# install borgbackup
apt-get update
apt-get -y install borgbackup
mkdir -p /opt/repo
# test execution
mkdir -p sample
cp /vagrant/Vagrantfile sample
# intializa repo
echo 'initialize...'
export BORG_PASSPHRASE=vagrant
borg init -e repokey /opt/repo
# backup
echo 'backup...'
borg create --stats /opt/repo::20190128 /home/vagrant/sample/*
# show
echo 'listing...'
borg list /opt/repo::20190128
# remove original file and restore it.
echo 'restore...'
rm -f /home/vagrant/sample/Vagrantfile
borg extract /opt/repo::20190128
cat ~vagrant/home/vagrant/sample/Vagrantfile
SHELL
end
○関連情報
・BorgBackupに関する他の記事はこちらを参照してください。
0 件のコメント:
コメントを投稿