{"id":27877,"date":"2018-08-30T03:39:30","date_gmt":"2018-08-30T08:39:30","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27877"},"modified":"2022-06-03T03:34:42","modified_gmt":"2022-06-03T08:34:42","slug":"how-to-install-invoice-ninja-on-debian-9","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-invoice-ninja-on-debian-9\/","title":{"rendered":"How to Install Invoice Ninja on Debian 9"},"content":{"rendered":"
<\/div>

\"How<\/p>\n

In this tutorial, we will show you how to install Invoice Ninja on Debian 9. Invoice Ninja is an open-source software application for invoicing and billing customers. It is built using PHP, on top of the Laravel framework. Some of the features include recurring invoices, creating tasks and projects, invoice designs, more than 40 payment options, and partial payments.<\/p>\n

Looking to get some fully managed hosting for InvoiceNinja account? We offer complete migration, installation, optimization, and customization – 100% free of charge! Check out our premium affordable Linux VPS hosting<\/a> packages and switch to a more secure, more efficient server with 24\/7\/265 amazing customer support today.<\/p>\n

<\/p>\n

This guide should work on other Linux VPS<\/a> systems as well but was tested and written for Debian 9 VPS<\/a>. If you want to install Invoice on CentOS 7, follow this tutorial.<\/a><\/p>\n

Step 1: Update your Debian server:<\/h3>\n

Log in to your VPS via SSH as a sudo user:<\/p>\n

ssh userame@IP_Addressinv<\/pre>\n

Once you are logged in, issue the following commands to make sure all installed packages are up to date:<\/p>\n

sudo apt-get update\nsudo apt-get upgrade<\/pre>\n

Step 2: Install Nginx, MariaDB and PHP 7<\/h3>\n

To install Nginx, MariaDB PHP 7 and all ty nessesary PHP modules on your Debian server run the following command:<\/p>\n

sudo apt-get install nginx php-fpm mysql-server php-cli php-common php-curl php-gd php-mysql php-xml php-mcrypt\u00a0php-mbstring<\/pre>\n

When the MariaDB installation is complete, run the following command to secure your MariaDB installation:<\/p>\n

sudo mysql_secure_installation<\/pre>\n

Step 3: Create a MariaDB database for Invoice Ninja<\/h3>\n

Login to the MariaDB console with the root account:<\/p>\n

mysql -u root -p<\/pre>\n

Create a MariaDB database, user and grant permissions to the user using the following command:<\/p>\n

MariaDB [(none)]> CREATE DATABASE ninja;\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'localhost' IDENTIFIED BY 'strongpassword';\nMariaDB [(none)]> FLUSH PRIVILEGES;\nMariaDB [(none)]> \\q<\/pre>\n

Do not forget to replace ‘strongpassword’ with an actual strong password.<\/p>\n

\"invoice<\/a><\/p>\n

Step 4: Download Invoice Ninja<\/h3>\n

We can either download the archive file from the download.invoiceninja.com<\/code>or check out the code from the GitHub Invoice Ninja repository. If you clone the GitHub repository you will need to use Composer to install the Invoice Ninja PHP dependencies while the archive file includes all required third-party PHP packages. In this post, we will install Invoice Ninja using the zip archive.<\/p>\n

Download the latest stable version of the Invoice Ninja zip archive in the \/tmp<\/code> directory on your server with:<\/p>\n

wget https:\/\/download.invoiceninja.com\/ -O \/tmp\/invoice-ninja.zip<\/pre>\n

Once the download is completed extract the archive in the \/var\/www\/html\/<\/code> directory:<\/p>\n

sudo unzip \/tmp\/invoice-ninja.zip -d \/var\/www\/html\/<\/pre>\n

Change the ownership to the www-data<\/code> user with the following command:<\/p>\n

sudo chown -R www-data: \/var\/www\/html\/ninja<\/pre>\n

Step 5: Configure Nginx to serve Invoice Ninja<\/h3>\n

Open your favorite text editor and create a new Nginx server block for the Invoice Ninja:<\/p>\n

sudo nano \/etc\/nginx\/sites-available\/your_ninja_domain.com.conf<\/pre>\n
server {\n    listen 80 default_server;\n    server_name your_ninja_domain.com www.your_ninja_domain.com;\n\n    root \/var\/www\/html\/ninja\/public;\n\n    index index.php;\n\n    charset utf-8;\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php?$query_string;\n    }\n\n    location = \/favicon.ico { access_log off; log_not_found off; }\n    location = \/robots.txt  { access_log off; log_not_found off; }\n\n    access_log  \/var\/log\/nginx\/your_ninja_domain.com.access.log;\n    error_log   \/var\/log\/nginx\/your_ninja_domain.com.error.log;\n\n    sendfile off;\n\n    location ~ \\.php$ {\n        fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\n        fastcgi_pass unix:\/var\/run\/php\/php7.0-fpm.sock;\n        fastcgi_index index.php;\n        include fastcgi_params;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_intercept_errors off;\n        fastcgi_buffer_size 16k;\n        fastcgi_buffers 4 16k;\n    }\n\n    location ~ \/\\.ht {\n        deny all;\n    }\n}\n<\/pre>\n

Activate the server block by creating a symbolic link with the following command:<\/p>\n

sudo ln -s \/etc\/nginx\/sites-available\/your_ninja_domain.com.conf  \/etc\/nginx\/sites-enabled\/your_ninja_domain.com.conf \n<\/pre>\n

Test the Nginx configuration and if there are no errors restart the nginx service\u00a0 using the following commands:<\/p>\n

sudo nginx -t\nsudo service nginx restart\n<\/pre>\n

\"invoice<\/a><\/h3>\n

Step 6: Install Invoice Ninja<\/h3>\n

Open http:\/\/your_ninja_domain.com\/<\/code> in your favorite web browser and you will be redirected to the Invoice Ninja setup page.<\/p>\n

From here you can finish the setup by entering the following information:<\/p>\n

Application Settings<\/strong><\/p>\n