Install Akaunting Self-Hosted Accounting Software on Ubuntu 20.04

This tutorial will be showing you how to install Akaunting on Ubuntu 20.04 with Apache or Nginx web server. Akaunting is a free, open-source self-hostable accounting software. You can use it for tracking personal finance or small business accounting.

akaunting-self-hosted-accounting-software-for-small-businesses

Akaunting Features

  • Completely Free and open source.
  • Easy-to-use web-based Interface. See your financials online anytime, anywhere on your Mac, PC, tablet or mobile phone.
  • Mobile & Tablet Ready Interface
  • Multilingual Admin & Client Panel
  • Designed For Small Businesses
  • 100% Financial Data Ownership
  • Lifetime FREE Updates
  • You can create clients and send invoices to them. You can also set a password so they could to access the client portal.
  • Send professional invoices to clients and start accepting online payments, no commission/transaction fee.
  • Add deposits to and transfers between accounts and keep the balance of your bank accounts active.
  • Create vendors so you could assign bills and payments to them and later filter their transactions easily.
  • Create and manage bills so your finances are always accurate and healthy. Know what and when to pay.
  • Add non-billable expenses as payments in order to keep your bank/cash account balances up-to-date.
  • Enable inventory tracking and manage goods as they come in and go out. Items also speed up invoicing.
  • Create unlimited bank and cash accounts and track their opening and current balances.
  • Send invoices and add expenses in any currency and let the system convert them in your main currency.
  • Manage the finances of multiple companies from one admin panel. Assign users to different companies.
  • Get detailed financial reports to help you better visualize all the information you need to improve your business.
  • Extend Akaunting by installing apps from the app store, you can install or purchase anything.
  • Configure permissions on a role level to protect and simplify their management experience.

Prerequisites of Installing Akaunting on Ubuntu 20.04

First, you need a Ubuntu server with at least 512MB RAM. If you are looking for a VPS (virtual private server), then you can click this special link to create an account on Vultr to get $50 free credit (for new users only). Once you have an account at Vultr, install Ubuntu 20.04 on your server and follow the instructions below.

Akaunting requires PHP and MySQL/MariaDB. To follow this tutorial, you should have already set up a LAMP stack or LEMP stack. If you prefer to use Apache web server, then install LAMP stack.

If you prefer to use Nginx web server, then install LEMP stack.

You also need a domain name, so your clients can see the invoice via your domain name. I registered my domain name at NameCheap because the price is low and they give whois privacy protection free for life.

Now let’s install Akaunting.

Step 1: Download Akaunting Install Zip File on Ubuntu 20.04 Server

Log into your Ubuntu 20.04 server and use the following command to download the latest stable version of Akaunting.

wget -O Akaunting.zip https://akaunting.com/download.php?version=latest

Then create a directory under the web root for Akaunting.

sudo mkdir -p /var/www/akaunting/

Extract the zip archive with unzip.

sudo apt install unzip

sudo unzip Akaunting.zip -d /var/www/akaunting/

The -d option specifies the target directory. Akaunting web files will be extracted to /var/www/akaunting/. Next, we need to change the owner of this directory to www-data so that the web server can write to this directory.

sudo chown www-data:www-data /var/www/akaunting/ -R

Step 2: Create a Database and User in MariaDB

Log into MariaDB database server with the following command. Since MariaDB is now using unix_socket plugin to authentication user login, there’s no need to enter MariaDB root password. We just need to prefix the mysql command with sudo.

sudo mysql -u root

Then create a database for Akaunting. This tutorial names the database akaunting. You can use whatever name you like.

create database akaunting;

Create the database user. Again, you can use your preferred name for this user. Replace your-password with your preferred password.

create user 'accountant'@'localhost' identified by 'your-password';

Grant this user all privileges on the akaunting database.

grant all privileges on akaunting.* to 'accountant'@'localhost';

Flush privileges and exit.

flush privileges;

exit;

Step 3: Install PHP Modules

Run the following commands to install PHP modules required or recommended by Akaunting.

sudo apt install php-imagick php7.4-common php7.4-mysql php7.4-gd php7.4-bcmath php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl

Then restart Apache. (If you use Nginx, you don’t need to restart Nginx.)

sudo systemctl restart apache2

Step 4: Setting Up Web Server

We can use Apache or Nginx web server.

Apache

If you prefer Apache, create a virtual host file for Akaunting with a command line text editor like Nano.

sudo nano /etc/apache2/sites-available/akaunting.conf

Put the following text into the file. Replace accounting.yourdomain.com with your real sub-domain for Akaunting. Don’t forget to set DNS A record for the domain name at your domain registrar’s DNS manager.

<VirtualHost *:80>
    ServerName accounting.yourdomain.com
    DocumentRoot /var/www/akaunting/

    <Directory /var/www/akaunting/>
       DirectoryIndex index.php
       Options +FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/akaunting.error.log
    CustomLog ${APACHE_LOG_DIR}/akaunting.access.log combined

</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite akaunting.conf

We need to enable the rewrite module.

sudo a2enmod rewrite

Restart Apache for the changes to take effect.

sudo systemctl restart apache2

Now visit accounting.yourdomain.com and you will be redirected to the setup wizard page (accounting.yourdomain.com/install/language). If you see the default Apache page instead of the setup wizard, then you need to disable the default virtual host.

sudo a2dissite 000-default.conf

And restart Apache.

Before entering any information in the setup wizard, we need to enable HTTPS.

Nginx

If you prefer Nginx, create a akaunting.conf file in /etc/nginx/conf.d/ directory.

sudo nano /etc/nginx/conf.d/akaunting.conf

Put the following text into the file. Replace accounting.yourdomain.com with your real sub-domain for Akaunting. Don’t forget to set DNS A record for the domain name at your domain registrar’s DNS manager.

server {
    listen      80;
    listen [::]:80;
    server_name accounting.yourdomain.com;

    root /var/www/akaunting/;
    index index.php index.html index.htm;
    charset utf-8;
    error_log /var/log/nginx/akaunting.error;
    access_log /var/log/nginx/akaunting.access;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # Prevent Direct Access To Protected Files
    location ~ \.(env|log) {
        deny all;
    }

    # Prevent Direct Access To Protected Folders
    location ~ ^/(^app$|bootstrap|config|database|resources|routes|storage|tests|artisan) {
        deny all;
    }
 
    # Prevent Direct Access To modules/vendor Folders Except Assets
    location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ {
        deny all;
    }
    
    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }

}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the changes to take effect.

sudo systemctl reload nginx

Now visit accounting.yourdomain.com and you will be redirected to the setup wizard page (accounting.yourdomain.com/setup). Before entering any information in the setup wizard, we need to enable HTTPS.

Step 5: Enabling HTTPS

To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu 20.04 server.

sudo apt install certbot

If you use Apache, you also need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

And run this command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d accounting.yourdomain.com

If you use Nginx, install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d accounting.yourdomain.com

Where

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping attack.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

akaunting-certbot-https-ubuntu-20.04

Step 6: Finish Installation with the Setup Wizard

Now go to accounting.yourdomain.com and the setup wizard will appear. First, you need to choose your language.

install-akaunting-ubuntu-20.04

Then enter the database information. Use the database name and database user created in step 2.

install-akaunting-with-apache-web-server-ubuntu-20.04

Next, enter company name and create an admin account.

install-akaunting-with-nginx-web-server-ubuntu-20.04

Once that’s done, you can log into the admin panel.

akaunting-ubuntu-20.04-server

After logging in, you need to follow the wizard to create your first company.

akaunting-setup-wizard-self-hosted

Now you can manage your finance in the web-based admin panel.

akaunting-self-hosted-accounting-software-for-small-businesses

Step 7: Configure SMTP

To send out emails (such as account registration, password reset, sending invoices to clients, etc), you need to configure an SMTP server. The SMTP settings are available at Settings -> Email -> Protocol. Use the following settings.

  • Protocol: SMTP
  • SMTP host: the hostname of your mail server like mail.linuxbabe.com
  • SMTP port: 587
  • Create an email address on your mail server and enter the SMTP username and password.
  • SMTP security: TLS

akaunting smtp settings

If you would like to use your own mail server to send emails to clients, please check out the following article to set up your own mail server. Note that I highly recommend running iRedMail mail server on a fresh clean OS. Installing iRedMail on an OS that has other web applications can fail, and likely break existing applications.

If you would like to use an SMTP relay service, I recommend Mailjet. You can follow the tutorial below to set up SMTP relay on your Akaunting server and you should be able to send invoice to clients.

Enable Paypal Payment

You can enable Paypal payment option in Settings -> Paypal Standard.

akaunting paypal standard

Troubleshooting

If you encounter errors in Akaunting, you can check the logs under /var/www/akaunting/storage/logs/ directory to troubleshoot problems.

Wrapping Up

I hope this tutorial helped you install Akaunting on Ubuntu 20.04 server. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 2 Average: 4.5]

12 Responses to “Install Akaunting Self-Hosted Accounting Software on Ubuntu 20.04

  • Steven
    6 days ago

    Very nice, but I just cannot get past step 2 of the install of the database section.
    I connect to the url and then enter the correct database, username and password and the next button just keeps flashing as if something is happening, but nothing does….

    • I installed Ubuntu using linuxbabe’s Ubuntu 20 LEMP install guide then used their installing myPHPadmin before moving onto this. I got as far as step 6 but the vhost just will not respond. The myPHP vhost works fine as did the LetsEncrypt cert install, so I guess the issue must be with the akaunting.conf file.

      Any suggestions would be useful.

      • So I tried using Incognito mode without success (before my post above) then gave up in desperation and rebooted the server … still no joy. Finally, I tied a different browser (Brave – which is oddly Chrome based, which was the browser I was using originally) and it worked. No idea why …

      • Herzog Albert
        5 days ago

        Thanks for this nice project. It matches precisely a recent need in my association.
        I am on a fresh Ubuntu 20.04 machine, using apache2 as web server.
        I got past step 2 of “installation by setup wizard” by installing the module php-mysql (in fact php7.4-mysql) on the server:
        command : apt-get install php-mysql
        I believe this package should be included in the list of php modules at step 3 “Installing php modules”.
        But I am stuck after next step of installation. I can create a “company name” with corresponding email addresses, etc. but the software does not seem to complete.
        I can see tables created in the mysql database.
        What is the URL of the “admin” panel ?
        Any hint to proceed?
        Thanks in advance.
        Robert

  • Steven
    6 days ago

    some strange DNS issue. I checked that the DB Tables were created and then entered the next step manually in the url bar

  • Jamiel Sharief
    6 days ago

    Thank you for writing this guide, never heard of this package before, but it looks great.

  • Herzog Albert
    5 days ago

    Hell and Devil !
    As suggested by Chris, I changed browser from Firefox to Chrome and BANG ! It works…
    I now reach the Assistant whre the Entreprise and such can be managed…
    Strange indeed.
    Robert

  • Herzog Albert
    4 days ago

    The problem of the calling browser seems to affect only the installation phase of the software. Once running, firefox seems to be a functional browser.
    Robert

  • Catalin Hodoleanu
    1 day ago

    I installed it behind nginx proxy on nginx host, it worked for like 2 days, but then i had issues with the interface, it not shows anything, only text, the other webservers are working fine.

    • If you use Nginx, you can create an Nginx virtual host. You don’t have to create a reverse proxy to another web server.

      • Catalin Hodoleanu
        16 hours ago

        I have my virtual hosts in conf.d with ports 8080->8090 and reverse proxy to listen them all to 443, it’s that ok?

        • Catalin Hodoleanu
          4 seconds ago

          I found the solution:

          https://akaunting.com/docs/developer-manual/reverse-proxy

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.