We’ve built an Headless Ubuntu-Based Linux Virtual Server host machine using Oracle’s VirtualBox and phpvirtualbox for administration and setup a minimal Ubuntu installation and installed the CraftBukkit Minecraft server. Now that we have it up and running, I want to configure an automatic backup of the Minecraft server files to the cloud using the free 50GB of storage that Box.com was kind enough to provide.
This tutorial will be done in two parts where the first part will be setting up the mount of our box.com account and the second part will be scripting and scheduling the RSYNC operation of our Craftbukkit/Minecraft Server directory.
First we are going to need to install the davfs2 package to allow WebDAV file system support on our ubuntu server.
minecraft@mcserver:~$ sudo apt-get install davfs2
Now we need to reconfigure the davfs2 package and select YES to allow unprivileged users access to mount WebDAV resources.
minecraft@mcserver:~$ sudo dpkg-reconfigure davfs2
Now add your user account to the davfs2 grop:
minecraft@mcserver:~$ sudo adduser $USER davfs2
Adding user `minecraft’ to group `davfs2′ …
Adding user minecraft to group davfs2
Let’s make a directory to mount our box.com account:
minecraft@mcserver:~$ mkdir ~/box.com
And edit /etc/fstab:
minecraft@mcserver:~$ sudo nano /etc/fstab
And paste this line, (editing your username):
https://www.box.com/dav /home/linuxusername/box.com davfs rw,user,noauto 0 0
Next let’s make the user-specific settings directory for davfs2 in our home directory:
nmino@mcserver:~$ mkdir ~/.davfs2
And copy the davfs2 config file to that directory for editing:
minecraft@mcserver:~$ cp /etc/davfs2/davfs2.conf ~/.davfs2
Now we need to edit the config file:
minecraft@mcserver:~$ nano .davfs2/davfs2.conf
The line to paste in the bottom of your davfs2.conf file is this:
Now we need to copy the davfs2 secrets file to our user’s davfs2 settings directory:
minecraft@mcserver:~$ sudo cp /etc/davfs2/secrets ~/.davfs2
And change ownership of that file to the current user:
minecraft@mcserver:~$ sudo chown $USER ~/.davfs2/secrets
Now edit that file:
minecraft@mcserver:~$ nano ~/.davfs2/secrets
And put this at the end of the file
https://www.box.com/dav ADDRESS@email.com PASSWORD
Where ADDRESS@email.com and PASSWORD are your box.com account and password.
Save the file and then mount your box.com account:
minecraft@mcserver:~$ mount box.com
That’s it for the first part. Our box.com account is now mounted in our user directory as ~/box.com.
Now we can continue to creating our RSYNC backup script to copy our Minecraft server to the cloud.