If you are like me, you were attracted to Akaunting accounting software because they are one of the first nice looking and open source accounting softwares around that operate in a similar way to the ‘friendly’ GUI systems like Quickbooks online. I was so upset about not having control of the data and / or price plans that I decided to take action.
The first thing I did was write a blog about how to install Akaunting on an Ubuntu Server.
I’m still very new into the game but the next thing I wanted to know about is ‘how do I back this thing up’. I searched the internet and to my surprise I found one post only about how to back it up with the ‘support’ advice as follows:
Question: Hello, how do I backup the system help me please?
Answer: You can copy all of the files and export your database using phpMyAdmin.
LOL! Good thing I know “more than zero about this”, but for those of you who don’t, perhaps this blog will help you. I’m writing it so that in the event the task has to be handed off I don’t have to spend a lot of time talking about it, but hopefully others will appreciate it as I document it.
Notify your Team
I added this section because I haven’t done this in the past. It might be quite simple to just start doing maintenance work like this without notifying those who might be doing work, especially if you have a small team and find yourself only thinking about you… So, have a list of people who use the software and send out something like the following message and be sure to stick to it:
Please note that the Akaunting software suite will be shut down for regular maintenance between _ (am/pm) and (am/pm) on (day of week), _ (date).
Thank you for your understanding and we apologize for any inconvenience.
Step 1 – Create your Local Backup File Structure
You will be downloading two things to your local machine for backup: the .sql database file and the zipped up folder of the Akaunting file / code etc. Should everything die, you could then put your files back and re-connect the database and everything should work as before the disaster which is why we’re downloading these regularly.
The way I set it up for Akaunting is a folder structure like this:
In the ‘server backups’ I put these two files (.sql / files) and in the ‘settings backups’ I export semi-regularly the settings from within Akaunting. You could omit the latter but I like redundancy plus with the exported spreadsheets you can more quickly open them to see how your data structures look in a more human readable way. See my blog for more about this part if you’re interested.
Step 2: Create a Backup Zone on Server
Create a directory called ‘backups’ or whatever you want to call it in your /tmp directory or /home directory or wherever you want to store your backups on the server before downloading. I’ll use my home directory for this example:
mkdir /home/user/akaunting_backups (‘user’ is your computer username of course)
NOTE: One time I accidentally created this directory with root user once and this whole tutorial failed. If you get weird permission issues when trying to backup files in here, possibly you made the same mistake. Just make sure you are creating directory with the user you plan to use for backing up.
Now you have a ‘master backup directory’ on your server.
Step 3: Create Date-Stamped Backup Directory
Now within that same directory you just made, create a date-stamped backup directory. I use simple YYMMDD for my directory name.
Step 4: Copy Akaunting Files to Backup Folder
- Navigate to where your Akaunting files are (usually in /var/www/html or thereabouts)
- Copy the whole thing to your new backup folder before compressing / zipping
sudo cp -r /var/www/html/akaunting /home/user/akaunting_backups/210531(using my example above)
- sudo is super powers
- cp is the copy command
- -r says ‘grab everything in the directory too
- /var/www/html/akaunting is the location of your akaunting files
- /home/user/akaunting_backups/210531 is the destination to where the directory should be copied
Navigate to /home/user/akaunting_backups/210531 to make sure the folder is there safely and contents are inside. Now you have your Akaunting files ready. Let’s do the database files next.
Step 5: MySql It!
Not as much of a ring on that title…
Now we’re going to back up the database file with all its tables which you would have created when you installed the Akaunting software
You can just go to my blog in the section called “Backing up your SuiteCRM MYSQL Database” as it’s exactly the same process here. Just adjust everything to your Akaunting database username and database name. My command looks somewhat like this as a reference:
sudo mysqldump -u akauntuser -p akaunting_db> /home/user/akaunting_backups/210531 akaunting_backup_210531.sql
Now you have both your Akaunting files and your mysql database in the backup folder called 210531 on your server.
Step 6: Just Zip it!
Much better ring to that title…
- Get the zip software tool:
sudo apt install zip
- Navigate one level up from where your YYMMDD directory is with your .sql and files inside. Where you are, is where your final backup .zip file will end up.
- Zip up the backup directory 210531 copied directory. Here is a good blog on zipping and unzipping in the command line by the way.
sudo zip -r akaunting_backup_210531.zip /home/user/akaunting_backups/210531
So this command shows sudo powers required, zip command, recursively zipping everything up (-r) creating the name of your backup file (akaunting_backup_yymmdd.zip) and the directory from whence it all comes (akaunting/). So it’s going to grab 210531, compress it, and rename it to akaunting_backup_210531.zip to be clear.
Press enter and watch a cool flurry of action for a bit….
Step 7: Go Get ’em, Tiger
See instructions here ‘Retrieving your Files’ with the handy SFTP command.
In my case I’m going to grab the last zip file I compressed above with a command that looks like this:
Step 8: Verify ’em
For the first time (at least) it’s probably a good idea to extract your zip folder on your local machine and inspect them to make sure things look ok. If all is good, now all you need to do is repeat steps 4-8 at the end of each week / day / whatever.
Hope all or some of this helps one or more of you