Invoice Ninja is a popular open-source platform for managing invoices, clients, and payments. However, due to their frequent release cycle, installation can sometimes be challenging.
This guide provides a step-by-step working method to install Invoice Ninja on a self-hosted Debian 12 Bookworm system. Before you start, ensure you have MariaDB, NGINX, and PHP 8.2 installed and configured.
Step 1: Install Required PHP Modules
Invoice Ninja requires several PHP modules to function correctly. Run the following command to install them:
1 2 |
sudo apt install php8.2-bcmath php8.2-gd php8.2-mbstring php8.2-xml php8.2-curl php8.2-zip php8.2-mysql php8.2-fpm php8.2-imagick php8.2-soap php8.2-common php8.2-intl php8.2-iconv php8.2-openssl |
Step 2: Create the Installation Directory
Create a directory for Invoice Ninja under /var/app
:
1 2 3 |
sudo mkdir -p /var/app/invoiceninja cd /var/app/invoiceninja |
Step 3: Download Invoice Ninja
Download the latest release of Invoice Ninja from their official GitHub repository. At the time of writing, version v5.9.6
is the latest stable version:
1 2 |
wget https://github.com/invoiceninja/invoiceninja/releases/download/v5.9.6/invoiceninja.tar |
Step 4: Extract the Files
Extract the downloaded .tar
file:
1 2 |
sudo tar -xf invoiceninja.tar |
Once extracted, delete the compressed file to save space:
1 2 |
sudo rm -rf invoiceninja.tar |
Step 5: Set Proper Ownership
Change the ownership of the invoiceninja
directory and its contents to the www-data
user:
1 2 |
sudo chown www-data: -R /var/app/invoiceninja |
Step 6: Install Composer Dependencies
If Composer is not installed, you can install it with:
1 2 |
sudo apt install composer |
Then, install the required dependencies for Invoice Ninja:
1 2 |
sudo -u www-data composer install |
Step 7: Configure the Environment File
Copy the default .env
file and make necessary updates for your environment:
1 2 |
sudo cp .env.example .env |
Change the ownership of the .env
file to www-data
:
1 2 |
sudo chown www-data: .env |
Edit the .env
file to match your database and system configuration. Ensure you update the following values:
1 2 3 4 5 |
APP_URL=https://yourdomain.com DB_DATABASE=invoiceninja DB_USERNAME=invoiceninja_user DB_PASSWORD=yourpassword |
Step 8: Generate the Application Key
Generate a secure application key:
1 2 |
sudo -u www-data php artisan key:generate |
Step 9: Clear Config Cache
Clear any cached configurations:
1 2 |
php artisan config:clear |
Final Steps
At this point, Invoice Ninja is installed and ready to configure in your browser. Ensure your NGINX configuration points to the /var/app/invoiceninja/public
directory as the root. Restart PHP-FPM and NGINX to apply changes:
1 2 3 |
sudo systemctl restart php8.2-fpm sudo systemctl restart nginx |
Troubleshooting
If you encounter any issues, ensure all dependencies are installed and check the NGINX and PHP-FPM logs for errors:
1 2 3 |
sudo tail -f /var/log/nginx/error.log sudo tail -f /var/log/php8.2-fpm.log |
With this guide, you should have a fully functional Invoice Ninja setup on your Debian 12 Bookworm server. Enjoy managing your invoices efficiently!