We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Ledger accounting system on Ubuntu 22.04|20.04|18.04

Learn how to – Install Ledger accounting system on Ubuntu 22.04|20.04|18.04.

This blog post will take you through the steps to install Ledger double-entry accounting system on Ubuntu 18.04. Ledger is a powerful command-line accounting tool based on the power and completeness of double-entry accounting. Ledger gives you unparalleled command-line reporting interface to your data without the need for a flashy UI.

With Ledger, all entries are kept in a text file that you maintain.  It figures out from looking at your data what you mean by it and how you want it reported back to you. Ledger is a double-entry accounting tool, meaning that all entries must balance. If an entry does not balance, it will cause an error and the report will not be generated.

Perform package index repo update

sudo apt update

Install Ledger on Ubuntu 22.04|20.04|18.04

There are two methods that can be used to install Ledger on Ubuntu.

Method 1: Install Ledger from OS APT repo

Update your APT package index:

sudo apt update

Then run the relevant commands to install Ledger

sudo apt install ledger

To check the version of Ledger software installed, run:

$ ledger --version
Ledger 3.1.3-20190331, the command-line accounting tool

Copyright (c) 2003-2019, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.

Method 2: Build Ledger from source

The ledger source code is available on GitHub. Install the dependencies required to build the application.

sudo apt install build-essential cmake doxygen 
     libboost-system-dev libboost-dev python3-dev gettext git 
     libboost-date-time-dev libboost-filesystem-dev 
     libboost-iostreams-dev libboost-python-dev libboost-regex-dev 
     libboost-test-dev libedit-dev libgmp3-dev libmpfr-dev texinfo tzdata

With the dependencies installed, clone the project from Github and build ledger application.

git clone git@github.com:ledger/ledger.git
sudo ln -sf  /usr/bin/python3 /usr/bin/python
cd ledger && ./acprep update

Confirm if your installation was successful:

$ ./ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool

Copyright (c) 2003-2019, John Wiegley.  All rights reserved.

This program is made available under the terms of the BSD Public License.
See LICENSE file included with the distribution for details and disclaimer.

Using Ledger double-entry accounting system on Ubuntu

Now that you have installed Ledger, it is time to use it for your accounting. The official Ledger Documentation cover many use cases with examples. Ledger needs a Journal File with a record of your financial transaction to work on.

An example journal is included with the source code distribution, called drewr3.dat (see Example Journal File). Download the file to your local machine:

wget https://raw.githubusercontent.com/ledger/ledger/master/test/input/drewr3.dat

This file exhibits many ledger features include automatic and virtual transactions.

Show balances of all of your accounts

$ ledger  -f drewr3.dat balance
         $ -3,804.00  Assets
          $ 1,396.00    Checking
             $ 30.00      Business
         $ -5,200.00    Savings
         $ -1,000.00  Equity:Opening Balances
          $ 6,654.00  Expenses
          $ 5,500.00    Auto
             $ 20.00    Books
            $ 300.00    Escrow
            $ 334.00    Food:Groceries
            $ 500.00    Interest:Mortgage
         $ -2,030.00  Income
         $ -2,000.00    Salary
            $ -30.00    Sales
            $ -63.60  Liabilities
            $ -20.00    MasterCard
            $ 200.00    Mortgage:Principal
           $ -243.60    Tithe
--------------------
           $ -243.60

This shows you the balance of all accounts. Options and search terms can pare this down to show only the accounts you want.

Show only your Assets and Liabilities:

A more useful report is to show only your Assets and Liabilities:

$ ledger -f drewr3.dat balance Assets Liabilities

See output below:

Register Report

To show all transactions and a running total:

$ ledger -f drewr3.dat register

Ledger will generate:

10-Dec-01 Checking balance                                     Assets:Checking                                                                  $ 1,000.00                      $ 1,000.00
                                                               Equity:Opening Balances                                                         $ -1,000.00                               0
10-Dec-20 Organic Co-op                                        Expenses:Food:Groceries                                                             $ 37.50                         $ 37.50
                                                               Expenses:Food:Groceries                                                             $ 37.50                         $ 75.00
                                                               Expenses:Food:Groceries                                                             $ 37.50                        $ 112.50
                                                               Expenses:Food:Groceries                                                             $ 37.50                        $ 150.00
                                                               Expenses:Food:Groceries                                                             $ 37.50                        $ 187.50
                                                               Expenses:Food:Groceries                                                             $ 37.50                        $ 225.00
                                                               Assets:Checking                                                                   $ -225.00                               0
10-Dec-28 Acme Mortgage                                        Liabilities:Mortgage:Principal                                                     $ 200.00                        $ 200.00
                                                               Expenses:Interest:Mortgage                                                         $ 500.00                        $ 700.00
                                                               Expenses:Escrow                                                                    $ 300.00                      $ 1,000.00
                                                               Assets:Checking                                                                 $ -1,000.00                               0
11-Jan-02 Grocery Store                                        Expenses:Food:Groceries                                                             $ 65.00                         $ 65.00
                                                               Assets:Checking                                                                    $ -65.00                               0
11-Jan-05 Employer                                             Assets:Checking                                                                  $ 2,000.00                      $ 2,000.00
                                                               Income:Salary                                                                   $ -2,000.00                               0
                                                               (Liabilities:Tithe)                                                               $ -240.00                       $ -240.00
11-Jan-14 Bank                                                 Assets:Savings                                                                     $ 300.00                         $ 60.00
                                                               Assets:Checking                                                                   $ -300.00                       $ -240.00
11-Jan-19 Grocery Store                                        Expenses:Food:Groceries                                                             $ 44.00                       $ -196.00
                                                               Assets:Checking                                                                    $ -44.00                       $ -240.00
11-Jan-25 Bank                                                 Assets:Checking                                                                  $ 5,500.00                      $ 5,260.00
                                                               Assets:Savings                                                                  $ -5,500.00                       $ -240.00
11-Jan-25 Tom's Used Cars                                      Expenses:Auto                                                                    $ 5,500.00                      $ 5,260.00
                                                               Assets:Checking                                                                 $ -5,500.00                       $ -240.00
11-Jan-27 Book Store                                           Expenses:Books                                                                      $ 20.00                       $ -220.00
                                                               Liabilities:MasterCard                                                             $ -20.00                       $ -240.00
11-Dec-01 Sale                                                 Assets:Checking:Business                                                            $ 30.00                       $ -210.00
                                                               Income:Sales                                                                       $ -30.00                       $ -240.00
                                                               (Liabilities:Tithe)                                                                 $ -3.60                       $ -243.60

To limit this to a more useful subset, simply add the accounts you are  interested in seeing transactions for:

$ ledger  -f drewr3.dat register Groceries
10-Dec-20 Organic Co-op                           Expenses:Food:Groceries                                       $ 37.50                 $ 37.50
                                                  Expenses:Food:Groceries                                       $ 37.50                 $ 75.00
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 112.50
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 150.00
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 187.50
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 225.00
11-Jan-02 Grocery Store                           Expenses:Food:Groceries                                       $ 65.00                $ 290.00
11-Jan-19 Grocery Store                           Expenses:Food:Groceries                                       $ 44.00                $ 334.00

This matches the balance reported for the Groceries’ account:

$ ledger  -f drewr3.dat balance Groceries
            $ 334.00  Expenses:Food:Groceries

If you would like to find a transaction to only a certain payee use ‘payee’ or ‘@’:

$ ledger -f drewr3.dat register payee "Organic"
10-Dec-20 Organic Co-op                           Expenses:Food:Groceries                                       $ 37.50                 $ 37.50
                                                  Expenses:Food:Groceries                                       $ 37.50                 $ 75.00
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 112.50
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 150.00
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 187.50
                                                  Expenses:Food:Groceries                                       $ 37.50                $ 225.00
                                                  Assets:Checking                                             $ -225.00                       0

Cleared Report

The cleared report shows what your obligations are versus what expenditures have actually been recorded.

$ ledger -f drewr3.dat cleared
     $ -3,804.00            $ 775.00                 Assets
      $ 1,396.00            $ 775.00    10-Dec-20      Checking
         $ 30.00                   0                     Business
     $ -5,200.00                   0                   Savings
     $ -1,000.00         $ -1,000.00    10-Dec-01    Equity:Opening Balances
      $ 6,654.00            $ 225.00                 Expenses
      $ 5,500.00                   0                   Auto
         $ 20.00                   0                   Books
        $ 300.00                   0                   Escrow
        $ 334.00            $ 225.00    10-Dec-20      Food:Groceries
        $ 500.00                   0                   Interest:Mortgage
     $ -2,030.00                   0                 Income
     $ -2,000.00                   0                   Salary
        $ -30.00                   0                   Sales
        $ -63.60                   0                 Liabilities
        $ -20.00                   0                   MasterCard
        $ 200.00                   0                   Mortgage:Principal
       $ -243.60                   0                   Tithe
----------------    ----------------    ---------
       $ -243.60                   0

Check Ledger Documentation to learn more. Similar guides are shared in below links:

Cart

Your Cart is Empty

Back To Shop