Difference between revisions of "Debian"

From GnuCash
Jump to: navigation, search
(Enabling debugging symbols)
m (Alternatively build a different version of Gnucash directly from source: more precision of versions)
(42 intermediate revisions by 17 users not shown)
Line 1: Line 1:
 
== Installing GnuCash on Debian ==
 
== Installing GnuCash on Debian ==
 +
=== Using the official Repositories ===
  
The name of the GnuCash package in Debian is [http://packages.debian.org/gnucash gnucash]. The easiest way to install it is to run <tt>apt-get install gnucash</tt>.
+
The name of the GnuCash package in Debian and Ubuntu is [http://packages.debian.org/gnucash gnucash]. The easiest way to install it is to run <tt>sudo aptitude install gnucash gnucash-common gnucash-docs</tt> from the command prompt.  If you need to use a GUI then install gnucash, gnucash-common and gnucash-docs using Synaptic Package Manager.
  
== Enabling HBCI on Debian ==
+
* Debian 8 (jessie) repository contains GnuCash 2.6.9.
 +
* Debian 9 (stretch) repository contains GnuCash 2.6.15.
  
In order to communicate with banks using the [[HBCI]] protocol, GnuCash uses the AqBanking library. Unfortunately, due to [http://www.gnome.org/~markmc/openssl-and-the-gpl.html licensing incompatibilities], the packages shipped by Debian are not allowed to make use of this library. The Debian bug tracking this issue is [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=303234 #303234].
+
=== Getting more recent packages from GetDeb ===
 +
There is normally a delay between the release of a new version of GnuCash and when it is available in the official repositories. An unofficial Debian package of the latest version can normally be obtained at [http://www.getdeb.net/app/GnuCash GetDeb].  This site releases Debian packages targeted at Ubuntu users.  However, they should work with other Debian based distributions.  You will need to download both  "gnucash" and "gnucash-common".  The name of the file will depend on the version and architecture of your machine. For this example the following filenames will be used:
  
Fortunately, support for HBCI can easily by re-enabled. This is done by rebuilding the gnucash package on your own machine, enabling the use of AqBanking in the process.
+
* gnucash_2.2.8-1~getdeb1_amd64.deb
 +
* gnucash-common_2.2.8-1~getdeb1_all.deb
  
=== Build instructions ===
+
To install them, run the following command in the directory where they are saved.  Change the filenames so that they match the ones you downloaded.
 +
<tt>sudo dpkg -i gnucash_2.2.8-1~getdeb1_amd64.deb gnucash-common_2.2.8-1~getdeb1_all.deb</tt>
  
These instructions apply to version '''2.0.1-2''' of [http://packages.debian.org/src:gnucash Debian's gnucash package], running on '''Debian 4.0 ("etch")'''. As time marches on, and the package is updated, the specific details of these instructions will become outdated, so be prepared to search for newer packages (e.g., libaqbanking17-dev instead of libaqbanking-16.dev) or use higher version numbers (e.g., 2.0.2 instead of 2.0.1) as necessary.
+
=== Using Synaptic Package Manager ===
 +
You can use ''Synaptic Package Manager'' to download and install the packages. Follow these steps.
 +
 
 +
* Add GetDeb repository GPG key:<br />Open a terminal window and as root:
 +
::<tt>wget -q -O- http://archive.getdeb.net/getdeb-archive.key | apt-key add -</tt>
 +
 
 +
* In Synaptic Package Manager
 +
** Add the GetDeb repository <br />Settings, Repositories, New
 +
*** Type: '''Deb'''
 +
*** URI: http://archive.getdeb.net/ubuntu
 +
*** Distribution: '''vivid-getdeb'''
 +
*** Section(s): '''apps'''
 +
*** OK and Reload when prompted
 +
** Search for '''gnucash''' to find the GnuCash packages
 +
*** Mark ''gnucash-common'' for installation
 +
*** Mark ''gnucash'' for installation
 +
*** Mark ''gnucash-docs'' for installation (optional)
 +
** Click the '''Apply''' button to start downloading and installation
 +
** When finished, you may wish to '''Disable''' the GetDeb repository so it is not scanned for updates unnecessarily.
 +
 
 +
===Using the Debian Archive===
 +
 
 +
GnuCash can also be downloaded from http://ftp.us.debian.org/debian/pool/main/g/gnucash/ which is an archive for old distributions of Debian but usually also includes fairly recent versions of GnuCash.
 +
 
 +
See http://ftp.us.debian.org/debian/README.html.
 +
 
 +
== Online Banking ==
 +
 
 +
For online banking, GnuCash uses the AqBanking library.  From a licensing incompatibility Debian and Ubuntu were unable to enable online banking in their gnucash packages.  But starting with Gnucash version 2.2.6 and AqBanking version 3.0 this incompatibility has been resolved.
 +
 
 +
Debian Lenny and Ubuntu 8.10 Intrepid now have gnucash packages with online banking enabled.  So for Debian Lenny and Ubuntu Intrepid, the gnucash package included in the distribution can be installed.
 +
 
 +
For Ubuntu Hardy, a backport of gnucash 2.2.6 are available from https://launchpad.net/~gnucash/+archive
 +
For Debian Etch, a backport of gnucash is available in etch-backports. http://packages.debian.org/etch-backports/gnucash
 +
 
 +
== Old Build Instructions (Ubuntu Gutsy and below, Debian sarge and below) ==
 +
 
 +
These instructions apply to version '''2.0.1-2''' of [http://packages.debian.org/src:gnucash Debian's gnucash package], running on '''Debian 4.0 ("etch")'''.  They also apply to '''Ubuntu Edgy''' gnucash version '''2.0.1-3ubuntu3''', but please consult the [[Ubuntu]] page for Ubuntu specific instructions. As time marches on, and the package is updated, the specific details of these instructions will become outdated, so be prepared to search for newer packages (e.g., libaqbanking17-dev instead of libaqbanking-16.dev) or use higher version numbers (e.g., 2.0.2 instead of 2.0.1) as necessary.
 +
 
 +
Additionally you need to recompile libaqbanking.
 +
 
 +
=== Downloading prerequisites ===
  
 
To begin with, install the packages that are required to build any Debian package, the packages that are required to build the gnucash package, the package for the AqBanking development library and a couple of other packages that we will make use of in the instructions below:
 
To begin with, install the packages that are required to build any Debian package, the packages that are required to build the gnucash package, the package for the AqBanking development library and a couple of other packages that we will make use of in the instructions below:
  
<pre># apt-get install build-essential devscripts fakeroot libaqbanking16-dev
+
<pre># sudo aptitude install build-essential devscripts fakeroot libaqbanking16-dev aqbanking16-qt-wizard
# apt-get build-dep gnucash</pre>
+
# sudo aptitude build-dep gnucash libaqbanking</pre>
  
If libaqbanking16-dev can not be found, try asking apt to install '''libaqbanking-dev'''. Apt should then tell you which package you really need.
+
If libaqbanking16-dev can not be found, try asking apt to install '''libaqbanking-dev'''. Apt should then tell you which package you really need.  Or try searching for libaqbanking on [http://packages.debian.org packages.debian.org] or [http://packages.ubuntu.com packages.ubuntu.com] to find the correct version.  Try [http://packages.debian.org/cgi-bin/search_packages.pl?keywords=libaqbanking&searchon=names&subword=1&version=all&release=all] or [http://packages.ubuntu.com/cgi-bin/search_packages.pl?searchon=names&subword=1&version=edgy&release=all&keywords=libaqbanking].
  
 
Make a directory to work in and download and extract the gnucash source code:
 
Make a directory to work in and download and extract the gnucash source code:
Line 24: Line 70:
 
<pre>$ mkdir gnucash
 
<pre>$ mkdir gnucash
 
$ cd gnucash
 
$ cd gnucash
$ apt-get source gnucash</pre>
+
$ apt-get source gnucash libaqbanking</pre>
 +
 
 +
=== GnuCash ===
 +
==== Configuring ====
  
The source code will now be extracted to a directory named '''gnucash-2.0.1'''. Now, we enable HBCI support. To do this, edit the '''debian/rules''' file:
+
The source code for gnucash will now be extracted to a directory named '''gnucash-2.x.x'''. Now, we enable HBCI support. To do this, edit the '''debian/rules''' file:
  
<pre>$ cd gnucash-2.0.1
+
<pre>$ cd gnucash-2.*
 
$ editor debian/rules</pre>
 
$ editor debian/rules</pre>
  
This is a makefile that specifies how to build the gnucash packages. Find where gnucash's configure script is invoked, and add <tt>'''--enable-hbci --enable-mt940'''</tt> to the configure script's arguments. When I did this I found it on line 24. I changed the line to read:
+
This is a makefile that specifies how to build the gnucash packages. Find where gnucash's configure script is invoked, and add <tt>'''--enable-hbci'''</tt> to the configure script's arguments. When I did this I found it on line 24. I changed the line to read:
  
 
<pre>env LDFLAGS="-L/usr/X11R6/lib" GUILE=/usr/bin/guile-1.6 CFLAGS="$(CFLAGS)" ./configure  
 
<pre>env LDFLAGS="-L/usr/X11R6/lib" GUILE=/usr/bin/guile-1.6 CFLAGS="$(CFLAGS)" ./configure  
--disable-static --sysconfdir=/etc --prefix=/ usr --mandir=/usr/share/man  
+
--disable-static --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man  
--infodir=/usr/share/info --libexecdir=/usr/lib -- libdir=/usr/lib/gnucash --enable-ofx  
+
--infodir=/usr/share/info --libexecdir=/usr/lib --libdir=/usr/lib/gnucash --enable-ofx  
--disable-error-on-warning --enable-hbci --enable-mt940 || cat config.log</pre>
+
--disable-error-on-warning --enable-hbci || cat config.log</pre>
 +
 
 +
Note:  <tt>'''--enable-mt940'''</tt> is no longer required as of 2.2.0; it is included in <tt>'''--enable-hbci'''</tt>.  For pre-2.2.0 builds, add <tt>'''--enable-mt940'''</tt> after <tt>'''--enable-hbci'''</tt> if that functionality is needed.
  
''Optional, but recommended:'' make a node of the changes you have made in the package's changelog. You can edit '''debian/changelog''' manually, but the '''devscripts''' package contains a utility to automate the process:
+
''Optional, but strongly recommended:'' make a note of the changes you have made in the package's changelog. The '''devscripts''' package contains a utility to automate the process:
  
 
<pre>$ debchange --nmu 'Enable HBCI support'</pre>
 
<pre>$ debchange --nmu 'Enable HBCI support'</pre>
  
It is a good idea to do this for two reasons:
+
This enables a few nice behaviors for your package.
  
# The version of your packages will be higher than the version of the packages in the Debian archive. This will prevent apt from installing Debian's own packages when you next upgrade.
 
 
# When you wonder in six months time, "what changes did I make to that package?", you can check by examining the '''/usr/share/doc/gnucash/changelog.Debian.gz''' file.
 
# When you wonder in six months time, "what changes did I make to that package?", you can check by examining the '''/usr/share/doc/gnucash/changelog.Debian.gz''' file.
 +
# The version of the package you are building will be slightly higher than the version of the packages in the Debian or Ubuntu archive. This will prevent apt from overwriting the new package with the old package from the archives.  If a new version of gnucash is packaged by the Debian or Ubuntu package maintainers, it will be installed over the package we are building here.  (You would then have to repeat these instructions.)
 +
 +
If this is not the desired result, you can apply a hold to the gnucash package.  See below for more information.
 +
 +
==== Building ====
  
 
Now we are ready to build the package.
 
Now we are ready to build the package.
Line 51: Line 106:
 
<pre>$ dpkg-buildpackage -b -us -uc -rfakeroot</pre>
 
<pre>$ dpkg-buildpackage -b -us -uc -rfakeroot</pre>
  
This is where you make a cup of tea (or, if you have a slow computer, go and watch the Lord of the Rings trilogy). Once the process is complete:
+
This is where you make a cup of tea (or, if you have a slow computer, go and watch the Lord of the Rings trilogy). If you want to verify that you did everything correctly, the command will output a bunch of "checking for ..." lines right at the beginning.  Look for the lines
 +
 
 +
<pre>checking whether to use OFX... yes -- failure is fatal
 +
checking for libofx version >= 0.7.0... found 0.8.0
 +
checking for libofx/libofx.h... yes
 +
checking for libofx... yes
 +
configure: WARNING: MT940 importing support is enabled but is totally experimental!
 +
checking for aqbanking >= "1.3.0"... yes
 +
checking HBCI_CFLAGS... 
 +
checking HBCI_LIBS... -laqbanking 
 +
checking for aqbanking >= "1.0.0"... yes
 +
checking HBCI_CFLAGS... 
 +
checking HBCI_LIBS... -laqbanking</pre>
 +
 
 +
Also, at the end of all the checking, configure will output a summary report.  Notice the ofx, hbci, and mt940 in the Optional Components line.
 +
 
 +
<pre>Options detected/selected
 +
  -------------------------
 +
  gnucash version ...... : 2.0.1
 +
  Build for host ....... : i686-pc-linux-gnu
 +
  Optional components....: ofx hbci mt940</pre>
 +
 
 +
==== Completing the install ====
 +
 
 +
<pre>$ cd ..
 +
# sudo dpkg --install gnucash_*.deb gnucash-common_*.deb</pre>
 +
 
 +
Finally, free up a few hundred MB of disk space (after verifying that gnucash works as expected) by removing the directory where the package was built:
 +
 
 +
<pre>$ rm -r gnucash-2.0.1</pre>
 +
 
 +
If you want to hold the package at the current version and prevent new upstream package versions from being installed, apt allows you to apply a hold to a package.  This will prevent apt from doing anything with the package.  One way to apply a hold (it can also be done in the various package manager guis) is by running:
 +
 
 +
<pre>$ echo "gnucash hold" | sudo dpkg --set-selections</pre>
 +
 
 +
More information about this can be found at [http://www.debian-administration.org/articles/332 debian-administration.org] and [http://www.debian.org/doc/manuals/apt-howto/ The APT Howto]
 +
 
 +
=== libaqbanking ===
 +
 
 +
==== Configuring ====
 +
 
 +
The source code for libaqbanking will now be extracted to a directory named '''libaqbanking-2.x.x'''. Now, we enable aqofxconnect support. To do this, we reverse these [http://svn.debian.org/wsvn/aqbanking/libaqbanking/trunk/debian/?rev=77&sc=1 changes].
 +
 
 +
Specifically:
 +
 
 +
edit the '''debian/rules''' file:
 +
 
 +
<pre>$ cd libaqbanking-2.*
 +
$ editor debian/rules</pre>
 +
 
 +
And add aqofxconnect to the list of backends.
 +
 
 +
i.e. from:
 +
 
 +
<pre>DEB_CONFIGURE_EXTRA_FLAGS := --disable-static --with-backends="aqhbci aqdtaus aqgeldkarte" --with-frontends="cbanking g2banking qbanking kbanking"</pre>
 +
 
 +
to:
 +
 
 +
<pre>DEB_CONFIGURE_EXTRA_FLAGS := --disable-static --with-backends="aqhbci aqdtaus aqgeldkarte aqofxconnect" --with-frontends="cbanking g2banking qbanking kbanking"</pre>
 +
 
 +
Create the file debian/libaqbanking-ofx0.install:
 +
<pre>$ editor debian/libaqbanking-ofx0.install</pre>
 +
 
 +
And put this text in it:
 +
<pre>usr/lib/aqbanking/plugins/16/imexporters/ofx.*
 +
usr/lib/aqbanking/plugins/16/providers/aqofxconnect.*
 +
usr/lib/aqbanking/plugins/16/frontends/qbanking/cfgmodules/aqofxconnect.*
 +
usr/lib/libaqofxconnect.so.*</pre>
 +
 
 +
<pre>$ edit debian/control</pre>
 +
 
 +
And add this (notice the single space at the start of some lines):
 +
<pre>Package: libaqbanking-ofx0
 +
Provides: libaqbanking-backend
 +
Enhances: libaqbanking0c2a
 +
Section: libs
 +
Architecture: any
 +
Depends: ${shlibs:Depends}
 +
Conflicts: libaqofxconnect4
 +
Description: library for OFX online banking
 +
AqBanking provides a middle layer between the applications
 +
and online banking libraries implementing various file formats and protocols.
 +
Plugins supporting OFX, DTAUS, and HBCI are available. For the latter,
 +
AqHBCI is required.
 +
.
 +
This package provides support for Open Financial Exchange (OFX) in AqBanking.
 +
OFX is a specification for the electronic exchange of financial data between
 +
financial institutions, business and consumers via the Internet.
 +
.
 +
Homepage: http://www.aquamaniac.de/aqbanking/
 +
</pre>
 +
 
 +
<pre>debchange --nmu 'Enable aqofxconnect'</pre>
 +
 
 +
==== Building ====
 +
 
 +
<pre>$ dpkg-buildpackage -b -us -uc -rfakeroot</pre>
 +
 
 +
Look for aqofxconnect:
 +
 
 +
<pre>Summary
 +
----------------------------------------------------
 +
AqBanking version  : 2.2.3.0-stable
 +
Supported backends : aqhbci aqdtaus aqgeldkarte aqofxconnect
 +
Supported frontends: cbanking g2banking qbanking kbanking</pre>
 +
 
 +
==== Installing ====
  
 
<pre>$ cd ..
 
<pre>$ cd ..
$ dpkg --install gnucash_*.deb gnucash-common_*.deb</pre>
+
# sudo dpkg --install libaqbanking-ofx0_*.deb</pre>
 +
 
 +
Optional:
  
Finally, free up a few hundred MB of disk space by removing the directory where the package was built:
+
<pre>$ rm -r libaqbanking-2.*</pre>
  
<pre>$ rm -r gnucash-2.0,1</pre>
+
<pre>$ echo "libaqbanking-ofx0 hold" | sudo dpkg --set-selections</pre>
  
 
== Enabling debugging symbols ==
 
== Enabling debugging symbols ==
Line 64: Line 227:
 
The procedure is similar to the one above:
 
The procedure is similar to the one above:
  
<pre># apt-get install build-essential fakeroot devscripts
+
<pre># aptitude install build-essential fakeroot devscripts
# apt-get build-dep gnucash
+
# aptitude build-dep gnucash
 
$ mkdir gnucash
 
$ mkdir gnucash
 
$ cd gnucash
 
$ cd gnucash
Line 78: Line 241:
 
$ cd ..
 
$ cd ..
 
# dpkg --install gnucash_*.deb gnucash-common_*.deb</pre>
 
# dpkg --install gnucash_*.deb gnucash-common_*.deb</pre>
 +
 +
== Alternatively build a different version of Gnucash directly from source ==
 +
=== GnuCash Versions <= 2.6.21 ===
 +
This may be useful if you want to use a later version than the ones in Debian's repositories. Rather than building a Debian package I just used the instructions provided by Gnucash for any flavour of Linux. These notes are no more than confirmation that those instructions work. I don't know enough about building packages - integrating a build within a package would presumably be a better longer term solution but the following gets the job done. I performed this install of Gnucash 2.2.4 into Debian Etch - this was my first foray into compiling and it wasn't difficult.
 +
 +
  $ sudo aptitude purge gnucash
 +
 +
First install all dependencies
 +
  $ sudo aptitude update
 +
  $ sudo aptitude install build-essential
 +
  $ sudo aptitude build-dep gnucash
 +
(someone else may know if any of these are not essential for this task, but they are sufficient)
 +
 +
download source and docs from Gnucash web site (in my case to my desktop)
 +
http://sourceforge.net/projects/gnucash/
 +
 +
move them to a new gnucash-source directory (obviously change "russell" to your own login name):
 +
  $ cd ~
 +
  $ mkdir gnucash-source
 +
  $ mv /home/russell/Desktop/gnucash* /home/russell/gnucash-source
 +
 +
unpack (creates 2 directories) - modify the file names as necessary (e.g. ...2.2.5 etc)
 +
  $ tar -xf gnucash-source/gnucash-2.2.4.tar.bz2
 +
  $ tar -xf gnucash-source/gnucash-docs-2.2.0.tar.gz
 +
 +
Installation instructions are in /home/russell/gnucash-source/gnucash-2.2.4/INSTALL which you may wish to read.
 +
 +
Now move into the directory you are going to compile from:
 +
  $ cd ~/gnucash-2.2.4
 +
 +
First you run the ./configure script. I am advised that you can get a cleaner install if you add --prefix in order to install in a separate directory i.e.
 +
  $ ./configure --prefix=/opt/gnucash-2.2.4
 +
This means that gnucash will install into /opt/gnucash-2.2.4 instead of the default /usr/local. The problem with the default is that it may be difficult to uninstall it if you want to upgrade the system with a later version or a Debian gnucash package, because there may also be other applications in /usr/local. However I didn't know about this at the time so I just used ./configure, next time I may try the --prefix
 +
 +
  $ ./configure
 +
  $ make
 +
  $ make check
 +
  (may not be necessary to do make check, but do it anyway in case it indicates a problem)
 +
  $ sudo make install
 +
 +
Also you will need to build the docs as they are a separate package
 +
  $ cd ~/gnucash-docs-2.2.0
 +
  $ ./configure
 +
    (if you want to use the --prefix make sure you use the same directory as above i.e.
 +
      ./configure --prefix=/opt/gnucash-2.2.4)
 +
  $ make
 +
  $ sudo make install
 +
 +
If you need to find the binary it should be in /opt/gnucash-2.2.4/bin or /usr/local/bin depending on whether or not you used the --prefix with ./configure.
 +
 +
When running Gnucash for the first time you will have to go through the setup - I chose default values
 +
 +
Optional cleanup:
 +
First you might want to archive the downloaded source if you want to be able to reinstall it later
 +
    $ mv /home/russell/gnucash-source /whereever/.
 +
Then you can remove the compile stuff by:
 +
    $ cd ~/gnucash-2.2.4
 +
    $ make clean
 +
    $ make distclean
 +
    $ cd ~/gnucash-docs-2.2.0
 +
    $ make clean
 +
    $ make distclean
 +
=== GnuCash Versions >= 3.0 ===
 +
Gnucash from version 3.0 no longer uses autotools for configuring the build and uses CMake instead. Until Debian specific instructions are provided consider adapting the build instructions for Ubuntu distributions [[Building#Ubuntu]]

Revision as of 02:34, 15 June 2018

Installing GnuCash on Debian

Using the official Repositories

The name of the GnuCash package in Debian and Ubuntu is gnucash. The easiest way to install it is to run sudo aptitude install gnucash gnucash-common gnucash-docs from the command prompt. If you need to use a GUI then install gnucash, gnucash-common and gnucash-docs using Synaptic Package Manager.

  • Debian 8 (jessie) repository contains GnuCash 2.6.9.
  • Debian 9 (stretch) repository contains GnuCash 2.6.15.

Getting more recent packages from GetDeb

There is normally a delay between the release of a new version of GnuCash and when it is available in the official repositories. An unofficial Debian package of the latest version can normally be obtained at GetDeb. This site releases Debian packages targeted at Ubuntu users. However, they should work with other Debian based distributions. You will need to download both "gnucash" and "gnucash-common". The name of the file will depend on the version and architecture of your machine. For this example the following filenames will be used:

  • gnucash_2.2.8-1~getdeb1_amd64.deb
  • gnucash-common_2.2.8-1~getdeb1_all.deb

To install them, run the following command in the directory where they are saved. Change the filenames so that they match the ones you downloaded. sudo dpkg -i gnucash_2.2.8-1~getdeb1_amd64.deb gnucash-common_2.2.8-1~getdeb1_all.deb

Using Synaptic Package Manager

You can use Synaptic Package Manager to download and install the packages. Follow these steps.

  • Add GetDeb repository GPG key:
    Open a terminal window and as root:
wget -q -O- http://archive.getdeb.net/getdeb-archive.key | apt-key add -
  • In Synaptic Package Manager
    • Add the GetDeb repository
      Settings, Repositories, New
    • Search for gnucash to find the GnuCash packages
      • Mark gnucash-common for installation
      • Mark gnucash for installation
      • Mark gnucash-docs for installation (optional)
    • Click the Apply button to start downloading and installation
    • When finished, you may wish to Disable the GetDeb repository so it is not scanned for updates unnecessarily.

Using the Debian Archive

GnuCash can also be downloaded from http://ftp.us.debian.org/debian/pool/main/g/gnucash/ which is an archive for old distributions of Debian but usually also includes fairly recent versions of GnuCash.

See http://ftp.us.debian.org/debian/README.html.

Online Banking

For online banking, GnuCash uses the AqBanking library. From a licensing incompatibility Debian and Ubuntu were unable to enable online banking in their gnucash packages. But starting with Gnucash version 2.2.6 and AqBanking version 3.0 this incompatibility has been resolved.

Debian Lenny and Ubuntu 8.10 Intrepid now have gnucash packages with online banking enabled. So for Debian Lenny and Ubuntu Intrepid, the gnucash package included in the distribution can be installed.

For Ubuntu Hardy, a backport of gnucash 2.2.6 are available from https://launchpad.net/~gnucash/+archive For Debian Etch, a backport of gnucash is available in etch-backports. http://packages.debian.org/etch-backports/gnucash

Old Build Instructions (Ubuntu Gutsy and below, Debian sarge and below)

These instructions apply to version 2.0.1-2 of Debian's gnucash package, running on Debian 4.0 ("etch"). They also apply to Ubuntu Edgy gnucash version 2.0.1-3ubuntu3, but please consult the Ubuntu page for Ubuntu specific instructions. As time marches on, and the package is updated, the specific details of these instructions will become outdated, so be prepared to search for newer packages (e.g., libaqbanking17-dev instead of libaqbanking-16.dev) or use higher version numbers (e.g., 2.0.2 instead of 2.0.1) as necessary.

Additionally you need to recompile libaqbanking.

Downloading prerequisites

To begin with, install the packages that are required to build any Debian package, the packages that are required to build the gnucash package, the package for the AqBanking development library and a couple of other packages that we will make use of in the instructions below:

# sudo aptitude install build-essential devscripts fakeroot libaqbanking16-dev aqbanking16-qt-wizard
# sudo aptitude build-dep gnucash libaqbanking

If libaqbanking16-dev can not be found, try asking apt to install libaqbanking-dev. Apt should then tell you which package you really need. Or try searching for libaqbanking on packages.debian.org or packages.ubuntu.com to find the correct version. Try [1] or [2].

Make a directory to work in and download and extract the gnucash source code:

$ mkdir gnucash
$ cd gnucash
$ apt-get source gnucash libaqbanking

GnuCash

Configuring

The source code for gnucash will now be extracted to a directory named gnucash-2.x.x. Now, we enable HBCI support. To do this, edit the debian/rules file:

$ cd gnucash-2.*
$ editor debian/rules

This is a makefile that specifies how to build the gnucash packages. Find where gnucash's configure script is invoked, and add --enable-hbci to the configure script's arguments. When I did this I found it on line 24. I changed the line to read:

env LDFLAGS="-L/usr/X11R6/lib" GUILE=/usr/bin/guile-1.6 CFLAGS="$(CFLAGS)" ./configure 
--disable-static --sysconfdir=/etc --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info --libexecdir=/usr/lib --libdir=/usr/lib/gnucash --enable-ofx 
--disable-error-on-warning --enable-hbci || cat config.log

Note: --enable-mt940 is no longer required as of 2.2.0; it is included in --enable-hbci. For pre-2.2.0 builds, add --enable-mt940 after --enable-hbci if that functionality is needed.

Optional, but strongly recommended: make a note of the changes you have made in the package's changelog. The devscripts package contains a utility to automate the process:

$ debchange --nmu 'Enable HBCI support'

This enables a few nice behaviors for your package.

  1. When you wonder in six months time, "what changes did I make to that package?", you can check by examining the /usr/share/doc/gnucash/changelog.Debian.gz file.
  2. The version of the package you are building will be slightly higher than the version of the packages in the Debian or Ubuntu archive. This will prevent apt from overwriting the new package with the old package from the archives. If a new version of gnucash is packaged by the Debian or Ubuntu package maintainers, it will be installed over the package we are building here. (You would then have to repeat these instructions.)

If this is not the desired result, you can apply a hold to the gnucash package. See below for more information.

Building

Now we are ready to build the package.

$ dpkg-buildpackage -b -us -uc -rfakeroot

This is where you make a cup of tea (or, if you have a slow computer, go and watch the Lord of the Rings trilogy). If you want to verify that you did everything correctly, the command will output a bunch of "checking for ..." lines right at the beginning. Look for the lines

checking whether to use OFX... yes -- failure is fatal
checking for libofx version >= 0.7.0... found 0.8.0
checking for libofx/libofx.h... yes
checking for libofx... yes
configure: WARNING: MT940 importing support is enabled but is totally experimental!
checking for aqbanking >= "1.3.0"... yes
checking HBCI_CFLAGS...  
checking HBCI_LIBS... -laqbanking  
checking for aqbanking >= "1.0.0"... yes
checking HBCI_CFLAGS...  
checking HBCI_LIBS... -laqbanking

Also, at the end of all the checking, configure will output a summary report. Notice the ofx, hbci, and mt940 in the Optional Components line.

Options detected/selected
  -------------------------
  gnucash version ...... : 2.0.1
  Build for host ....... : i686-pc-linux-gnu
  Optional components....: ofx hbci mt940

Completing the install

$ cd ..
# sudo dpkg --install gnucash_*.deb gnucash-common_*.deb

Finally, free up a few hundred MB of disk space (after verifying that gnucash works as expected) by removing the directory where the package was built:

$ rm -r gnucash-2.0.1

If you want to hold the package at the current version and prevent new upstream package versions from being installed, apt allows you to apply a hold to a package. This will prevent apt from doing anything with the package. One way to apply a hold (it can also be done in the various package manager guis) is by running:

$ echo "gnucash hold" | sudo dpkg --set-selections

More information about this can be found at debian-administration.org and The APT Howto

libaqbanking

Configuring

The source code for libaqbanking will now be extracted to a directory named libaqbanking-2.x.x. Now, we enable aqofxconnect support. To do this, we reverse these changes.

Specifically:

edit the debian/rules file:

$ cd libaqbanking-2.*
$ editor debian/rules

And add aqofxconnect to the list of backends.

i.e. from:

DEB_CONFIGURE_EXTRA_FLAGS := --disable-static --with-backends="aqhbci aqdtaus aqgeldkarte" --with-frontends="cbanking g2banking qbanking kbanking"

to:

DEB_CONFIGURE_EXTRA_FLAGS := --disable-static --with-backends="aqhbci aqdtaus aqgeldkarte aqofxconnect" --with-frontends="cbanking g2banking qbanking kbanking"

Create the file debian/libaqbanking-ofx0.install:

$ editor debian/libaqbanking-ofx0.install

And put this text in it:

usr/lib/aqbanking/plugins/16/imexporters/ofx.*
usr/lib/aqbanking/plugins/16/providers/aqofxconnect.*
usr/lib/aqbanking/plugins/16/frontends/qbanking/cfgmodules/aqofxconnect.*
usr/lib/libaqofxconnect.so.*
$ edit debian/control

And add this (notice the single space at the start of some lines):

Package: libaqbanking-ofx0
Provides: libaqbanking-backend
Enhances: libaqbanking0c2a
Section: libs
Architecture: any
Depends: ${shlibs:Depends}
Conflicts: libaqofxconnect4
Description: library for OFX online banking
 AqBanking provides a middle layer between the applications
 and online banking libraries implementing various file formats and protocols.
 Plugins supporting OFX, DTAUS, and HBCI are available. For the latter,
 AqHBCI is required.
 .
 This package provides support for Open Financial Exchange (OFX) in AqBanking.
 OFX is a specification for the electronic exchange of financial data between
 financial institutions, business and consumers via the Internet.
 .
 Homepage: http://www.aquamaniac.de/aqbanking/
debchange --nmu 'Enable aqofxconnect'

Building

$ dpkg-buildpackage -b -us -uc -rfakeroot

Look for aqofxconnect:

Summary
----------------------------------------------------
AqBanking version  : 2.2.3.0-stable
Supported backends : aqhbci aqdtaus aqgeldkarte aqofxconnect
Supported frontends: cbanking g2banking qbanking kbanking

Installing

$ cd ..
# sudo dpkg --install libaqbanking-ofx0_*.deb

Optional:

$ rm -r libaqbanking-2.*
$ echo "libaqbanking-ofx0 hold" | sudo dpkg --set-selections

Enabling debugging symbols

The procedure is similar to the one above:

# aptitude install build-essential fakeroot devscripts
# aptitude build-dep gnucash
$ mkdir gnucash
$ cd gnucash
$ apt-get source gnucash
$ cd gnucash-2.0.1
$ editor debian/rules

Now add the --enable-debug option to the arguments of the configure script.

$ debchange --nmu 'Enable debugging'
$ DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage -b -us -uc -rfakeroot
$ cd ..
# dpkg --install gnucash_*.deb gnucash-common_*.deb

Alternatively build a different version of Gnucash directly from source

GnuCash Versions <= 2.6.21

This may be useful if you want to use a later version than the ones in Debian's repositories. Rather than building a Debian package I just used the instructions provided by Gnucash for any flavour of Linux. These notes are no more than confirmation that those instructions work. I don't know enough about building packages - integrating a build within a package would presumably be a better longer term solution but the following gets the job done. I performed this install of Gnucash 2.2.4 into Debian Etch - this was my first foray into compiling and it wasn't difficult.

 $ sudo aptitude purge gnucash

First install all dependencies

 $ sudo aptitude update
 $ sudo aptitude install build-essential
 $ sudo aptitude build-dep gnucash

(someone else may know if any of these are not essential for this task, but they are sufficient)

download source and docs from Gnucash web site (in my case to my desktop) http://sourceforge.net/projects/gnucash/

move them to a new gnucash-source directory (obviously change "russell" to your own login name):

 $ cd ~
 $ mkdir gnucash-source
 $ mv /home/russell/Desktop/gnucash* /home/russell/gnucash-source

unpack (creates 2 directories) - modify the file names as necessary (e.g. ...2.2.5 etc)

 $ tar -xf gnucash-source/gnucash-2.2.4.tar.bz2
 $ tar -xf gnucash-source/gnucash-docs-2.2.0.tar.gz

Installation instructions are in /home/russell/gnucash-source/gnucash-2.2.4/INSTALL which you may wish to read.

Now move into the directory you are going to compile from:

 $ cd ~/gnucash-2.2.4

First you run the ./configure script. I am advised that you can get a cleaner install if you add --prefix in order to install in a separate directory i.e.

 $ ./configure --prefix=/opt/gnucash-2.2.4

This means that gnucash will install into /opt/gnucash-2.2.4 instead of the default /usr/local. The problem with the default is that it may be difficult to uninstall it if you want to upgrade the system with a later version or a Debian gnucash package, because there may also be other applications in /usr/local. However I didn't know about this at the time so I just used ./configure, next time I may try the --prefix

 $ ./configure
 $ make
 $ make check
 (may not be necessary to do make check, but do it anyway in case it indicates a problem)
 $ sudo make install

Also you will need to build the docs as they are a separate package

 $ cd ~/gnucash-docs-2.2.0
 $ ./configure
    (if you want to use the --prefix make sure you use the same directory as above i.e.
     ./configure --prefix=/opt/gnucash-2.2.4)
 $ make
 $ sudo make install

If you need to find the binary it should be in /opt/gnucash-2.2.4/bin or /usr/local/bin depending on whether or not you used the --prefix with ./configure.

When running Gnucash for the first time you will have to go through the setup - I chose default values

Optional cleanup: First you might want to archive the downloaded source if you want to be able to reinstall it later

   $ mv /home/russell/gnucash-source /whereever/.

Then you can remove the compile stuff by:

   $ cd ~/gnucash-2.2.4
   $ make clean
   $ make distclean
   $ cd ~/gnucash-docs-2.2.0
   $ make clean
   $ make distclean

GnuCash Versions >= 3.0

Gnucash from version 3.0 no longer uses autotools for configuring the build and uses CMake instead. Until Debian specific instructions are provided consider adapting the build instructions for Ubuntu distributions Building#Ubuntu