In Part 1 of this series, I explained the basics of using the Linux command-line interface (CLI), including how to install hledger from the Ubuntu repositories. But I realized after publishing that post that there is a significant difference between the version of hledger available in the repositories and the most-recent release published by the hledger developers.
This is not an uncommon problem in Linux, particularly with distributions like Ubuntu that have staggered, periodic releases. It takes some time for an individual program’s updates to work its way through the system and into a release. And if you use a long-term support release, as I do for work, then you may have a program that is several versions behind.
For example, here is the version of hledger available in each of the current and upcoming Ubuntu releases:
The most-recent release of hledger was version 1.12. So even the latest Ubuntu package (1.10) is still a couple of released behind. This led me to stop and reconsider which hledger package I should use going forward with this tutorial series.
How to Install hledger 1.10 in Ubuntu 18.04
Now, I run hledger 1.12 on my main work computer. This is accomplished by using a special installation script prepared by the hledger development team. What this script does is download and compile all of the source code required to run hledger and its multiple libraries (or dependencies in code-speak).
You are certainly free to try and run the installation script yourself. But asking your computer to compile source code directly is a tall order. On one of my Lenovo laptops, which has a four-core Intel processor, the machine froze several times without attempting, unsuccessfully, to complete the installation script. And even when my main computer managed to successfully install hledger from source code, it took well over an hour.
The lesson here is that it is generally preferable for “end users” such as ourselves to rely on pre-compiled packages prepared by a distribution like Ubuntu. With that in mind, I decided to use the hledger 1.10 package available in Ubuntu 19.04 as my baseline going forward with this series.
Of course, Ubuntu 19.04 itself has not yet been officially released. It is currently in testing. But the individual packages are still available for download, and I found a way to install and run hledger 1.10 in Ubuntu 18.04 that only requires typing a few commands into a terminal emulator.
Basically, all you need to do is type these five commands in order and follow any system prompts you see:
sudo apt install libatomic1
sudo dpkg -i libtinfo6_6.1+20180210-4ubuntu1_amd64.deb
sudo dpkg -i hledger_1.10-3_amd64.deb
For reference, here is a brief explanation of what each of these commands do:
- The first command instructs the system to retrieve and install a library called libatomic1 from the existing Ubuntu 18.04 LTS repositories.
- wget is a simple utility that downloads files from the web via the command-line interface. The second command downloads the hledger 1.10 package from the Ubuntu 19.04 repositories. The third command downloads another library, this one called libtinfo6, also from the 19.04 repositories.
- dpkg is similar to apt, the package installation system I discussed in more detail in Part 1 of this series. In fact, apt is really just a front-end for dpkg, which operates as more of a “behind the scenes” utility. The fourth and fifth commands install the two packages you just downloaded via the wget command. This is why the
dpkgcommand is followed with the
-ior install option flagged.
- As I have discussed in earlier posts, it is necessary to add
sudoto any command that makes permanent changes to the system, which in this case means installing software.
Categories: Linux Tutorials