How to Install StockazNG on Manjaro

StockazNG is a free and open-source self-hosted web application for managing expenses and invoices. In this tutorial, we will guide you through the steps of installing StockazNG on your Manjaro system.

Prerequisites

Installation

  1. Open a terminal window on your Manjaro system.

  2. Install the necessary dependencies:

    sudo pacman -S git nginx php php-fpm php-pgsql composer
    
  3. Clone the StockazNG repository:

    git clone https://dev.sigpipe.me/dashie/StockazNG.git
    
  4. Navigate to the project directory:

    cd StockazNG
    
  5. Install the required PHP packages:

    composer install
    
  6. Edit the config.php file with your database credentials:

    cp config.php.dist config.php
    nano config.php
    
  7. In the config.php file, update the database section to match your PostgreSQL database configuration:

    'database' => [
       'dsn' => 'pgsql:host=localhost;dbname=stockazng',
       'username' => 'postgres',
       'password' => '',
    ],
    
  8. Create a new database in PostgreSQL:

    sudo -u postgres createdb stockazng
    
  9. Run the following command to set up the database schema:

    ./bin/console doctrine:schema:create
    
  10. Create a virtual host for StockazNG in the /etc/nginx/sites-available/ directory:

    sudo nano /etc/nginx/sites-available/stockazng
    
  11. Add the following Nginx server block to the stockazng file:

    server {
        listen 80;
        server_name example.com;
        root /path/to/stockazng/web;
        index index.php;
    
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }
    
        location ~ ^/(index)\.php(/|$) {
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            fastcgi_split_path_info ^(.+\.php)(/.*)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
        }
    
        location ~ \.php$ {
            return 404;
        }
    
        error_log /var/log/nginx/stockazng-error.log;
        access_log /var/log/nginx/stockazng-access.log;
    }
    
  12. Enable the StockazNG virtual host:

    sudo ln -s /etc/nginx/sites-available/stockazng /etc/nginx/sites-enabled/
    
  13. Restart Nginx to apply the changes:

    sudo systemctl restart nginx
    
  14. Grant the required permissions to the var/ directory:

    sudo chown -R www-data:www-data var/
    
  15. Finally, open your web browser and navigate to http://localhost to access StockazNG.

Congratulations! You have successfully installed StockazNG on your Manjaro system. You can now start using it to manage expenses and invoices.

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!