Invoice Ninja is an open-source platform for invoicing and payment management. It is perfect for small and medium businesses as it provides a comprehensive solution of invoice generation, payment management, and expense tracking.
This tutorial will guide you on how to install Invoice Ninja on Debian Latest.
Before proceeding with the installation, make sure that you have the following:
First, update the package lists and install required packages for Invoice Ninja:
sudo apt update
sudo apt install curl wget zip unzip git apt-transport-https lsb-release ca-certificates gnupg
Install PHP and required PHP extensions:
sudo apt install php php-curl php-gd php-intl php-json php-mbstring php-mysql php-xml php-zip
Install MySQL or MariaDB database:
sudo apt install mariadb-server
Once the installation is completed, log in to the MariaDB shell and create a new database and user for Invoice Ninja:
sudo mysql -u root -p
CREATE DATABASE invoiceninja;
GRANT ALL PRIVILEGES ON invoiceninja.* TO 'invoiceninjadbuser'@'localhost' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES;
EXIT;
Composer is a PHP package installer that is required to install Invoice Ninja. To install Composer, use the following command:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Download the latest version of Invoice Ninja and install it to the web server:
sudo mkdir /var/www/html/invoiceninja
sudo chown -R www-data:www-data /var/www/html/invoiceninja/
sudo -u www-data git clone https://github.com/invoiceninja/invoiceninja.git /var/www/html/invoiceninja/
cd /var/www/html/invoiceninja/
sudo -u www-data composer install --no-dev -o
Create the .env
file in the /var/www/html/invoiceninja
directory and configure the database connection:
sudo -u www-data cp .env.example .env
sudo nano .env
Update the following variables:
APP_URL=http://your_domain_or_IP_address
DB_DATABASE=invoiceninja
DB_USERNAME=invoiceninjadbuser
DB_PASSWORD=yourpassword
Save and close the file.
Configure your web server as follows:
Create a new virtual host configuration file:
sudo nano /etc/apache2/sites-available/invoiceninja.conf
Add the following configuration:
<VirtualHost *:80>
# Your Server Name, i.e domain or IP
ServerName your_domain_or_IP_address
# Your Server Alias if you have any
# ServerAlias invoiceninja.example.com
DocumentRoot /var/www/html/invoiceninja/public
<Directory /var/www/html/invoiceninja/public>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/invoiceninja_error.log
CustomLog ${APACHE_LOG_DIR}/invoiceninja_access.log combined
</VirtualHost>
Save and close the file.
Enable the new virtual host configuration and restart Apache:
sudo a2ensite invoiceninja.conf
sudo systemctl restart apache2
Create a new virtual host configuration file:
sudo nano /etc/nginx/sites-available/invoiceninja.conf
Add the following configuration:
server {
listen 80;
server_name your_domain_or_IP_address;
root /var/www/html/invoiceninja/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Save and close the file.
Enable the new virtual host configuration and restart NGINX:
sudo ln -s /etc/nginx/sites-available/invoiceninja.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Launch your web browser and access Invoice Ninja using the following URL:
http://your_domain_or_IP_address
You will see the Invoice Ninja login page. Login with your credentials and start using Invoice Ninja.
You have successfully installed Invoice Ninja on Debian Latest. You can further explore and modify Invoice Ninja according to your requirements.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!