Akaunting is a powerful, open-source accounting application designed for small businesses and freelancers. By self-hosting Akaunting, you gain full control over your data, advanced customization options, and the ability to adapt it to your unique needs. This guide will walk you through deploying Akaunting, configuring it with tools like Nginx, managing backups, and leveraging its core features to get the most out of your setup.
Installing Akaunting
π¦ Docker/Docker Compose Setup
Running Akaunting with Docker allows for an efficient and isolated deployment. Create a docker-compose.yml
file with the following configuration:
version: '3.8'
services:
akaunting:
image: akaunting/akaunting:latest
container_name: akaunting-app
restart: unless-stopped
ports:
- "8080:80"
volumes:
- akaunting_data:/var/www/html
environment:
- APP_KEY=base64:YOUR_APP_KEY_HERE
- DB_HOST=akaunting-db
- DB_PORT=3306
- DB_DATABASE=akaunting
- DB_USERNAME=akaunting_user
- DB_PASSWORD=securepassword
akaunting-db:
image: mariadb:10.5
container_name: akaunting-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
- MYSQL_DATABASE=akaunting
- MYSQL_USER=akaunting_user
- MYSQL_PASSWORD=securepassword
volumes:
- akaunting_db_data:/var/lib/mysql
volumes:
akaunting_data:
akaunting_db_data:
Deploy the stack with the following commands:
docker-compose up -d
Verify that Akaunting is running by visiting http://<SERVER_IP>:8080
in your browser.
π Manual Installation
To install Akaunting manually on a Linux server, follow these steps:
- Update your server and install dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server php php-mysql php-cli php-xml unzip curl -y
- Download and extract Akaunting:
wget https://akaunting.com/download/latest -O akaunting.zip
unzip akaunting.zip -d /var/www/akaunting
- Set permissions and configure Apache:
sudo chown -R www-data:www-data /var/www/akaunting
sudo chmod -R 755 /var/www/akaunting
-
Create a new virtual host for Akaunting (refer to the Nginx section below for Apache equivalent).
-
Access Akaunting via your browser and complete the setup wizard.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
Set up Nginx as a reverse proxy to route traffic to Akaunting:
server {
listen 80;
server_name akaunting.example.com;
root /var/www/akaunting/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Restart Nginx to apply the configuration:
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure Akaunting with Let's Encrypt:
- Install Certbot:
sudo apt install certbot python3-certbot-nginx -y
- Get an SSL certificate:
sudo certbot --nginx -d akaunting.example.com
- Automate SSL renewals:
sudo systemctl enable certbot.timer
Logging and Debugging Akaunting
ποΈ Enabling Debug Logs
Enable debug logging in Akaunting by editing the .env
file:
nano /var/www/akaunting/.env
Set the following value:
APP_DEBUG=true
π Viewing Logs
For Docker setups, view logs using:
docker logs akaunting-app
For manual installations, check the log files:
tail -f /var/www/akaunting/storage/logs/laravel.log
π οΈ Troubleshooting Common Issues
If Akaunting fails to load or shows errors, common issues include incorrect permissions or missing PHP extensions. Verify the required extensions are installed:
php -m | grep -E 'mbstring|openssl|pdo|xml|ctype|json'
Backup and Restore
ποΈ File-Based Backups
Backup Akauntingβs files:
tar -czvf akaunting-backup-$(date +%F).tar.gz /var/www/akaunting
π Database Backups
Export the database:
mysqldump -u akaunting_user -p akaunting > akaunting-db-backup.sql
Restore the database:
mysql -u akaunting_user -p akaunting < akaunting-db-backup.sql
π Automated Backup Scripts
Automate backups with a cron job:
crontab -e
Add the following line:
0 2 * * * tar -czvf /backup/akaunting-$(date +\%F).tar.gz /var/www/akaunting && mysqldump -u akaunting_user -p'securepassword' akaunting > /backup/akaunting-db-$(date +\%F).sql
Updating and Upgrading Akaunting
β¬οΈ Updating Docker Images
Pull the latest Docker image and restart containers:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
To update manually, download the latest Akaunting release and replace the existing files, ensuring to back up the .env
file and database first.
π Checking for Updates
Visit Akaunting's official update page to verify if a new version is available.
Leveraging Akauntingβs Unique Features
π§ Enabling APIs
Activate the Akaunting API by setting the following in .env
:
API_ENABLED=true
Access the API via curl
:
curl -X GET "http://akaunting.example.com/api/v1/transactions" -H "Authorization: Bearer YOUR_API_TOKEN"
π Advanced Configurations
To extend Akauntingβs functionality, install apps from the Akaunting App Store. For example, install an app via the CLI:
composer require akaunting/your-app-name
Wrapping Up
This guide has provided you with detailed steps to deploy, configure, and manage Akaunting in a self-hosted environment. From Docker deployment to advanced configurations, you now have the tools to make the most of Akauntingβs robust capabilities. Begin customizing and optimizing your setup today to fully leverage its powerful features!