UbuntuUbuntu Based

How To Install Invoice Ninja on Ubuntu 24.04 LTS

Install Invoice Ninja on Ubuntu 24.04 LTS

Invoice Ninja is a powerful open-source invoicing and billing platform that offers freelancers and small to medium-sized businesses an efficient way to manage their finances. With its user-friendly interface and extensive features, Invoice Ninja simplifies the process of creating and sending invoices, tracking expenses, and accepting payments. By installing Invoice Ninja on the latest Ubuntu 24.04 LTS, users can take advantage of enhanced security features and improved performance, ensuring a seamless and reliable invoicing experience.

Prerequisites

Before proceeding with the installation of Invoice Ninja on Ubuntu 24.04 LTS, ensure that your system meets the following requirements:

  • A server or virtual machine running Ubuntu 24.04 LTS
  • Minimum 512 MB RAM (1 GB or more recommended)
  • A valid domain name pointing to your server’s IP address
  • SSH access to your server with root or sudo privileges

Additionally, you will need to install the following software:

  • Apache or Nginx web server
  • PHP 8.3 with required extensions
  • MariaDB or MySQL database server

Step 1: Update System Packages

Before installing any software, it’s crucial to update your system packages to ensure you have the latest security patches and bug fixes. Open your terminal and run the following commands:

sudo apt update
sudo apt upgrade

These commands will fetch the latest package lists from the repositories and upgrade any outdated packages to their latest versions. Keeping your system up to date is essential for maintaining security and optimal performance.

Step 2: Install Apache/Nginx and PHP

Invoice Ninja requires a web server to run, and you can choose between Apache and Nginx. For this guide, we’ll use Apache. Install Apache by running:

sudo apt install apache2

Next, install PHP 8.3 and the necessary extensions:

sudo apt install php8.3 libapache3-mod-php8.3 php8.3-mysql php8.3-curl php8.3-gd php8.3-mbstring php8.3-xml php8.3-zip

To optimize PHP performance, you can modify the php.ini file and adjust settings such as memory_limit and upload_max_filesize according to your needs.

Step 3: Configure MariaDB/MySQL

Invoice Ninja stores its data in a database, and you can use either MariaDB or MySQL. Install MariaDB with the following command:

sudo apt install mariadb-server

After installation, secure your MariaDB server by running the security script:

sudo mysql_secure_installation

Follow the prompts to set a strong root password, remove anonymous users, disable remote root login, and remove the test database. These steps are crucial for securing your database server.

Next, log in to the MariaDB shell and create a database and user for Invoice Ninja:

sudo mysql -u root -p

CREATE DATABASE invoice_ninja;
CREATE USER 'ninja_user'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON invoice_ninja.* TO 'ninja_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace your_strong_password with a secure password for your Invoice Ninja database user.

Step 4: Download and Install Invoice Ninja

Download the latest version of Invoice Ninja from the official website:

wget https://download.invoiceninja.com/ninja-v5.5.76.zip

Extract the downloaded package to your web server’s document root directory:

sudo unzip ninja-v5.5.76.zip -d /var/www/html/invoice-ninja

Set the appropriate ownership and permissions for the extracted files:

sudo chown -R www-data:www-data /var/www/html/invoice-ninja
sudo chmod -R 755 /var/www/html/invoice-ninja/storage

Proper file ownership and permissions are essential for ensuring the security of your Invoice Ninja installation.

Step 5: Configure Web Server for Invoice Ninja

Create an Apache virtual host configuration file for Invoice Ninja:

sudo nano /etc/apache2/sites-available/invoice-ninja.conf

Add the following configuration:

<VirtualHost *:80>
    ServerName your_domain.com
    ServerAlias www.your_domain.com
    DocumentRoot /var/www/html/invoice-ninja/public

    <Directory /var/www/html/invoice-ninja/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/invoice-ninja.error.log
    CustomLog ${APACHE_LOG_DIR}/invoice-ninja.access.log combined
</VirtualHost>

Replace your_domain.com with your actual domain name. Save the file and exit the editor.

Enable the Invoice Ninja virtual host and the Apache rewrite module:

sudo a2ensite invoice-ninja.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 6: Secure Invoice Ninja with SSL

To ensure secure transactions and protect sensitive data, it’s crucial to enable SSL for your Invoice Ninja installation. Install the Certbot client and obtain a free SSL certificate from Let’s Encrypt:

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d your_domain.com -d www.your_domain.com

Follow the prompts to provide an email address and agree to the Let’s Encrypt terms of service. Certbot will automatically configure your Apache virtual host to use the SSL certificate.

To redirect HTTP traffic to HTTPS, modify your Invoice Ninja virtual host configuration:

sudo nano /etc/apache2/sites-available/invoice-ninja.conf

Add the following lines before the closing </VirtualHost> tag:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Save the file, exit the editor, and restart Apache:

sudo systemctl restart apache2

Step 7: Complete Invoice Ninja Setup

Open your web browser and navigate to your Invoice Ninja installation URL (e.g., https://your_domain.com). You will be redirected to the setup wizard.

Follow these steps to complete the setup:

  1. Select your language and click “Next.”
  2. Enter your database connection details (host, database name, username, and password) and click “Next.”
  3. Create an admin account by providing your email address and a strong password.
  4. Configure your company details, including name, address, and logo.
  5. Choose your preferred currency and tax settings.
  6. Review the installation summary and click “Finish.”

Congratulations! You have successfully installed InvoiceNinja. Thanks for using this tutorial for installing Invoice Ninja on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Invoice Ninja website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button