
Here’s a clear, step-by-step guide detailing how to install LedgerSMB on Debian VPS.
What is LedgerSMB?
LedgerSMB is an open-source accounting and ERP (Enterprise Resource Planning) system designed for small to medium-sized businesses. It offers a secure, multi-user web interface for managing financial data, inventory, invoices, customers, vendors, and more.
🧾 Key Features
- General Ledger – Tracks all accounting transactions.
- Accounts Receivable (AR) – Manages customer invoices and payments.
- Accounts Payable (AP) – Handles vendor bills and payments.
- Inventory Management – Tracks stock levels, pricing, and cost of goods.
- Multi-user and Role-based Access – Allows different levels of user access.
- Multi-currency & Multi-language – Supports international operations.
- Audit-friendly – Designed to be transparent and secure for compliance.
🛠️ Technology Stack
- Backend: Written in Perl
- Database: Uses PostgreSQL
- Frontend: Web-based UI served via Apache or Nginx
- Operating System: Linux-based systems, especially Debian and Ubuntu
🔓 Open Source Benefits
- No licensing fees
- Active community and developer support
- Highly customizable
- Transparent and auditable code
🏢 Who Uses LedgerSMB?
- Small businesses needing accounting software
- Nonprofits managing grants and donations
- Freelancers and consultants handling invoicing
- Organizations wanting an on-premise, secure alternative to QuickBooks or Xero
In short, LedgerSMB is a powerful, secure, and free alternative to commercial accounting systems—ideal for organizations that want full control over their financial data and infrastructure.
🔧 Prerequisites
Before you begin, make sure you have:
- A Debian 11+ VPS with root access
- At least 1 GB of RAM
- A non-root sudo user
- Basic knowledge of the Linux command line
- A domain name (optional, but recommended for HTTPS)

✅ How to Install LedgerSMB on Debian VPS
To install LedgerSMB on Debian VPS, follow the steps below:
-
🧱 Update Your System
sudo apt update && sudo apt upgrade -y
Reboot if there are kernel updates:
sudo reboot
-
🐘 Install PostgreSQL
LedgerSMB relies on PostgreSQL.
sudo apt install postgresql -y
Create a PostgreSQL user for LedgerSMB:
sudo -i -u postgres createuser --createdb --createrole --login ledgersmb psql -c "ALTER USER ledgersmb WITH PASSWORD 'securepassword';" exit
Replace
'securepassword'
with a strong, unique password. -
🌐 Install Apache + mod_fcgid (Optional: nginx works too)
sudo apt install apache2 libapache2-mod-fcgid -y
Enable necessary Apache modules:
sudo a2enmod fcgid rewrite ssl sudo systemctl restart apache2
-
📦 Install Dependencies for LedgerSMB
sudo apt install \ libdbd-pg-perl \ libtemplate-perl \ libapache2-mod-fcgid \ liblocale-maketext-lexicon-perl \ liblocale-maketext-simple-perl \ libyaml-libyaml-perl \ libjson-perl \ liblog-log4perl-perl \ libmoosex-nonmoose-perl \ libtry-tiny-perl \ libconfig-std-perl \ libdbix-safe-perl \ libdatetime-format-strptime-perl \ libhtml-parser-perl \ libmoose-perl \ libperl-dev \ cpanminus \ git \ make \ gcc \ -y
-
📥 Download LedgerSMB
Clone the latest stable release:
cd /opt sudo git clone https://github.com/ledgersmb/LedgerSMB.git cd LedgerSMB sudo git checkout 1.12 # Or replace with latest stable version
-
🔨 Install Perl Modules via cpanm (if any are missing)
Run the dependency check:
sudo cpanm --installdeps .
You may need to run this multiple times or install modules manually if errors occur.
-
🗃 Set Up LedgerSMB Directories
sudo mkdir -p /var/www/ledgersmb sudo cp -r /opt/LedgerSMB/* /var/www/ledgersmb/ sudo chown -R www-data:www-data /var/www/ledgersmb
-
📄 Configure Apache for LedgerSMB
Create a new site config:
sudo nano /etc/apache2/sites-available/ledgersmb.conf
Paste the following:
<VirtualHost *:80> ServerAdmin admin@yourdomain.com ServerName yourdomain.com Redirect permanent / https://yourdomain.com/ </VirtualHost> <VirtualHost *:443> ServerAdmin admin@yourdomain.com ServerName yourdomain.com DocumentRoot /var/www/ledgersmb SSLEngine on SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf <Directory /var/www/ledgersmb> Options +ExecCGI AddHandler fcgid-script .pl DirectoryIndex lsmb-request.pl AllowOverride None Require all granted </Directory> ScriptAlias /ledgersmb /var/www/ledgersmb/lsmb-request.pl ErrorLog ${APACHE_LOG_DIR}/ledgersmb_ssl_error.log CustomLog ${APACHE_LOG_DIR}/ledgersmb_ssl_access.log combined </VirtualHost>
Enable the site:
sudo a2ensite ledgersmb sudo systemctl reload apache2
-
🔐 Secure with HTTPS (Let’s Encrypt)
Install Certbot:
sudo apt install certbot python3-certbot-apache -y
Run Certbot:
sudo certbot --apache
-
🚀 Initialize LedgerSMB
Now access LedgerSMB in your browser:
https://yourdomain.com/ledgersmb
You should see the setup screen.
Create your first database:
- Use the ledgersmb PostgreSQL user.
- Choose a company name (it becomes the database name).
- Follow the prompts to create the admin user and finalize setup.
-
🧼 Cleanup and Secure
- Delete
/var/www/ledgersmb/tools
after setup to avoid exposure. - Set up a firewall (e.g.,
ufw
) to protect your VPS.
sudo ufw allow OpenSSH sudo ufw allow "Apache Full" sudo ufw enable
- Delete
✅ Done!

You’ve successfully installed LedgerSMB on a Debian VPS.
🧠 Tips
- LedgerSMB stores each company in its own database.
- Back up regularly using
pg_dump
. - Check logs in
/var/log/apache2
or LedgerSMB’s own logs if issues arise.
Conclusion
You now know how to install LedgerSMB on Debian VPS.