# Install Invoice Plane - Invoice and Payment Manager - On Linux

## What is Invoice Plane?

> [Invoice Plane is a] self-hosted open source application for managing your invoices, clients and payments.-https://www.invoiceplane.com/

## Installation

1. Log into the Linux device
2. Run the following commands in a terminal window:
   # update software repositories
   sudo apt update
   # install available software updates
   sudo apt upgrade -y
   # install prerequisites
   sudo apt install curl wget zip -y
   # install Apache HTTPD and MySQL
   sudo apt install apache2 mariadb-server mariadb-client -y
   # install PHP components
   sudo apt install php7.4 php7.4-curl php7.4-common php7.4-json php7.4-mysqli php7.4-gd php7.4-mbstring php7.4-xmlrpc -y
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type N and press Enter to not switch to unix socket authentication
5. Type Y and press Enter to set a root password, type the password twice to confirm
6. Type Y and press Enter to remove anonymous users
7. Type Y and press Enter to disallow root login remotely
8. Type Y and press Enter to remove the test database
9. Type Y and press Enter to reload privilege tables
10. Run the following command to login into MySQL:
    mysql -u root -p
11. Authenticate with the root password set earlier
12. Run the following commands to create the Invoice Plane database and database user
    CREATE DATABASE invoice_plane;
    GRANT ALL ON invoice_plane.* to 'invoice_plane_rw'@'localhost' IDENTIFIED BY 'Inv0!c3Pl@n3!';
    FLUSH PRIVILEGES;
    EXIT;
    exit
13. Continue with the following commands:
    # fetch the latest download URL
    regex='"browser_download_url": "(https:\/\/github.com\/InvoicePlane\/InvoicePlane\/releases\/download\/[^/]*\/[^/]*\.zip)"' && response=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/InvoicePlane/InvoicePlane/releases/latest) && [[ $response =~ $regex ]] && downloadURL="${BASH_REMATCH[1]}"
    # download the latest release
    wget -O invoiceplane.zip $downloadURL
    # create target directory
    sudo mkdir /var/www/html/invoiceplane
    # extract the downloaded zip to /var/www/html/invoiceplane
    sudo unzip ./invoiceplane.zip -d /var/www/html/invoiceplane
    # copy sample config file
    sudo cp /var/www/html/invoiceplane/ipconfig.php.example /var/www/html/invoiceplane/ipconfig.php
    # edit config.php
    sudo nano /var/www/html/invoiceplane/ipconfig.php
14. Scroll down to the const IP_URL variable and set the value to the IP address or DNS name of the host

    IP_URL=http://localhost/invoiceplane

15. Press CTRL+O, Enter, CTRL+X to write the changes
16. Continue with the following commands:
    # set the owner of the invoiceplane directory
    sudo chown -R www-data:www-data /var/www/html/invoiceplane

## Invoice Plane Web Installer

1. Open a web browser and navigate to http://DNSorIP/invoiceplane
2. The Invoice Plane Installation web installer should be load
3. Click the Setup button
4. Select a Language > Click Continue
5. Click Continue on the Prerequisites page
6. Complete the Database Details form as follows

   Hostname: localhost
   Port: 3306
   Username: invoice_plane_rw
   Password: Inv0!c3Pl@n3!
   Database: invoice_plane

7. Click the Try Again button then click Continue
8. Complete the Create User Account form > Click Continue
9. Back in the terminal, run the following command to disable the setup wizard
   # set the DISABLE_SETUP flag to true
   sudo sed -i 's/DISABLE_SETUP=false/DISABLE_SETUP=true/g' /var/www/html/invoiceplane/ipconfig.php
10. Click the Login button
11. Login with the Email and Password setup during the installation
12. Welcome to Invoice Plane

Source: https://wiki.invoiceplane.com/en/1.0/getting-started/installation