Steps to install Akaunting software on Windows 10 using WSL

Akaunting is free and open source accounting software that uses PHP & MySQL to run and available on GitHub. Thus, no need to use any client or the installation of accounting software on every system of a company or home. Any user who wants to use the Akaunting for small and medium business or personal usage can access it locally or remotely with the help of the internet and browser, once installed.

We can install Akaunting for a demo or permanent use on Windows 10 ‘s WSL Apache local web server without using XAMPP. Here in this tutorial, we will learn how to do that.

Akaunting installation on Windows 10 Subsystem for Linux -WSL

Software requirements:

PHP 7.2 or higher, Web Server (eg: Apache, Nginx, IIS), Database (eg: MySQL, PostgreSQL, SQLite, SQL Server); URL Rewrite (mod_rewrite) and Php extensions: PDO, OpenSSL, Mbstring, Tokenizer, XML and Zip.

1. Command to Enable WSL on Windows 10

WSL- Windows Subsystem for Linux is a Windows 10 feature that allows users to run Linux commands using various distros shell apps. The common one is Ubuntu.  So, to enable this feature, right-click on Windows 10 start button and select the “Windows Powershell (Admin)” option.

Now run the below command-

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Enable WSL using command line in Powershell min

Restart your system…

 

2. Install Ubunut 20.4 WSL app

Open Microsoft Store on your OS and search for Ubuntu 20.04 LTS, it is the latest long-term version available to install.  Click on the Get button and once it is installed hit the Launch.

Install Ubuntu 20.04 WSL app min

 

3. Install Apache Webserver

As you launch the Ubuntu WSL app, first it will ask you to set up a username and password. After that run the system update command-

sudo apt update

Now, run Apache webserver installation command-

sudo apt install apache2

 

4. Start Apache Service

We cannot use systemctl command here, because WSL has not booted with systemd as init system, thus run the service command here i.e

sudo service apache2 start

Start Apache serice on WSL Windows 10 min

To check whether it is working fine or not, open your system browser and type- 127.0.0.1

Check Apache service on WSL Windows 10 min

 

5. Setup MySQL server on WSL for Akaunting database

To store the data of Akaunting, we need a database. MySQL or MariaDB are the two popular ones to use. Here we are installing MySQL.

sudo apt install mysql-server

Start MySQL service

sudo service mysql start

If you get the following error:

Errors were encountered while processing:
mysql-server-8.0
E: Sub-process /usr/bin/dpkg returned an error code (1)
h2s@DESKTOP-S24E7BS:~$ sudo service mysql start
* Starting MySQL database server mysqld su: warning: cannot change directory to /nonexistent: No such file or directory

MySQL service start fail WSL windows 10

Then follow these steps further:

Assign a home directory to the MySQL user-

sudo usermod -d /var/lib/mysql/ mysql

Now, change the port for MySQL service:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Find the port, uncomment it (means remove the #) and then change the 3306 to 8060

user = mysql
# pid-file = /var/run/mysqld/mysqld.pid
# socket = /var/run/mysqld/mysqld.sock
port = 8060
# datadir = /var/lib/mysql

To save the file press Ctrl+X, type Y, and then hit the Enter button.

Change MySQL port on WSL

Now, start the MySQL service

sudo service mysql start

Service start mysql successfully

 

6. PHP Installation

Now, let’s install PHP and required modules to Install Akaunting on WSL in Windows 10.

sudo apt install php libapache2-mod-php php-imagick php-bcmath php-common php-imap php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl

 

7. Create Database for Akaunting

Before creating a database for Akaunting let’s secure our MySQL installation. However, you can skip this step if you don’t want to use Akaunting remotely.

sudo mysql_secure_installation

The process will ask you few questions, such as validate the strength of the user password, remove the demo user and table, disable remote root login to the database, and more. Follow them.

 

Now, let’s create a database-

sudo mysql

Note: Replace red-colored entries – demo is the database name; h2suser is a database user whereas the pass is for password.

create database demo;

creater user 'h2suser'@'localhost' IDENTIFIED BY 'pass';
grant all privileges on demo.* to h2suser@localhost;

flush privileges;
exit

 

8. Download Akaunting files to upload on the webserver

The below-given command will download the latest Akaunting files –

wget -O Akaunting.zip https://akaunting.com/download.php?version=latest
sudo mkdir -p /var/www/akaunting/

sudo apt install unzip

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

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

sudo chmod -R 755 /var/www/html/akaunting/

 

9. Configure Apache site configuration file for Akaunting

Let’s create an Apache configuration file for Akaunting so that we don’t need to point the URL to its folder every time in the browser.

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

Paste the following lines exactly as they are here…

<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot /var/www/akaunting/
ServerName example.com
ServerAlias www.example.com

<Directory /var/www/akaunting/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

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

</VirtualHost>

 

To save and exit the nano editor, press: Ctrl+X keys and type: Y, and then hit the Enter button.

 

Enable the configuration and rewrite modules.

sudo a2ensite akaunting.conf
sudo a2enmod rewrite

Restart webserver-

service apache2 restart

Disable default configuration-

sudo a2dissite 000-default.conf

 

Open Akaunting Setup Wizard

Well, now everything is running, go to your browser and enter the IP address of your PC where WSL is installed, or simply type 127.0.0.1

Select Language for your Akaunting platform.

Select Language

Enter the details of the Database you have created.

Connect Database

Create Akaunting Admin account.

Create Akaunting Admin account on WSL

Log in to access the further setup wizard of Akaunting.

Login Akaunting

Setup Wizard