Install GnuCash 4.1 on CentOS 8

Documentation date: 2020-08-04.

GnuCash is currently not available for CentOS 8. These instructions will guide you through the compilation from source. Unfortunately, some prerequisites have been decommissioned from Red Hat 8 or are otherwise not available. So you also have to build those first. This makes it a bit of a tedious job.

I am making an effort to keep changes to the core OS at a minimum so you can easily update or revert back to stock packages, should packages become available. Therefore, I am using the /usr/local/src folder. Installations should be put to /usr/local as these are not distribution packages. Do feel free to deviate from the src folder to make your installation more permanent.

This setup will allow you to connect to your bank using the latest FinTS/HBCI protocol using PSD2 features. For that, non-release versions of Aqbanking/Gwenhywfer are being used (latest release candidates).

Let me know, if this article has helped you and/or saved you tons of time. I am also happy to hear any improvement suggestions (ws1909@bluhm-de.com)

Features:

- GnuCash 4.1 with MySQL support and Python Bindings.
- Tons of other packages like gmock, gtest, libunistring, libofx, gwenhywfar, bdw-gc, opensp, texinfo, xmlsec1-gnutls

Assumption: "Workstation" module is installed

### Easy way (you also need the PowerTools repo):
# NOTE: This will install the latest available GnuCash version.
dnf -y copr enable sbluhm/os-tools
dnf -y gnucash

### Manual way:

dnf -y update
CPU_CORES=$((`nproc` - 1 | bc)) # This will use all but 1 CPU core in conjunction with make -j
if [ "$CPU_CORES" -lt "1" ]; then CPU_CORES=1; fi

# Starting off with Aqbanking

## Gwenhywfer
dnf -y install gnutls-devel libgcrypt-devel libtool automake autoconf qt5-qtbase-devel  gcc-c++ gtk3-devel qt5-linguist openssl-devel

sudo ln -s /usr/bin/moc-qt5 /usr/bin/moc
sudo ln -s /usr/bin/lrelease-qt5 /usr/bin/lrelease
sudo ln -s /usr/bin/lupdate-qt5 /usr/bin/lupdate
sudo ln -s /usr/bin/uic-qt5 /usr/bin/uic
sudo ln -s /usr/bin/qmake-qt5 /usr/bin/qmake

GWEN_VERSION=5.4.0
cd /usr/local/src
wget --content-disposition https://codeload.github.com/aqbanking/gwenhywfar/zip/${GWEN_VERSION}
unzip gwenhywfar-${GWEN_VERSION}
cd gwenhywfar-${GWEN_VERSION}
autoreconf -i
./configure --with-guis="gtk3 qt5"
make -j${CPU_CORES}
make install # installs gwenhywfar to /usr/lib/cmake/${GWEN_VERSION}

# Aqbanking

#Building AqBanking. 5.99.42beta+ does not compile due to transactions.c. not found.
AQ_VERSION=5.99.41beta
export LD_LIBRARY_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# Note that xmlsec1-gnutls-devel is part of the centos8-powertools-x86_64 repository
dnf -y install autoconf libtool automake gmp-devel gnutls-devel libgcrypt-devel gcc-c++ libtool-ltdl-devel libxslt-devel bzip2 xmlsec1-gnutls-devel xmlsec1-gcrypt xmlsec1-gnutls
cd /usr/local/src
wget --content-disposition https://codeload.github.com/aqbanking/aqbanking/zip/${AQ_VERSION}
unzip aqbanking-${AQ_VERSION}.zip
cd aqbanking-${AQ_VERSION}
export LD_LIBRARY_PATH=/usr/lib
autoreconf -i
./configure
make # does not compile multicore
make install

 

# Gengetopt
GENGETOPT_VER=2.23
dnf -y install gcc-c++ texinfo help2man opensp-devel libcurl-devel
cd /usr/local/src
wget ftp://ftp.gnu.org/gnu/gengetopt/gengetopt-${GENGETOPT_VER}.tar.xz
tar xf gengetopt-${GENGETOPT_VER}.tar.xz
cd gengetopt-${GENGETOPT_VER}
./configure
make -j${CPU_CORES}
make install

#  Libofx
LIBOFX_VERSION=0.9.15
dnf -y install autoconf libtool automake
cd /usr/local/src
wget https://github.com/libofx/libofx/archive/${LIBOFX_VERSION}.tar.gz
tar xf ${LIBOFX_VERSION}.tar.gz
cd libofx-${LIBOFX_VERSION}
autoreconf -i
export LD_LIBRARY_PATH=/usr/local/lib
./configure
make # does not compile multicore
make install

 

# now off to compile gnucash (yeah, finally)
# Enable the PowerTools repository for Google Mock/Google Test

export LD_LIBRARY_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

cd /usr/local/src
export GNUCASH_VERSION=4.1
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm # install EPEL
dnf -y install webkit2gtk3-devel swig  libdbi-devel libdbi-dbd-mysql python3-devel libsecret-devel libxslt-devel boost-devel guile-devel gtest-devel gmock-devel boost169
# clear cache of previous compiles
rm -Rf ~/.cache/guile
rm -Rf /usr/local/lib/guile/2.2/ccache/
rm -Rf /usr/local/lib64/guile/2.2/ccache/
wget https://github.com/Gnucash/gnucash/releases/download/${GNUCASH_VERSION}/gnucash-${GNUCASH_VERSION}.tar.bz2
tar xf gnucash-${GNUCASH_VERSION}.tar.bz2
mkdir build-gnucash-${GNUCASH_VERSION}
cd build-gnucash-${GNUCASH_VERSION}
cmake -DWITH_PYTHON=ON -DBOOST_INCLUDEDIR=/usr/include/boost169 -DBOOST_LIBRARYDIR=/usr/lib64/boost169 ../gnucash-${GNUCASH_VERSION}
make -j${CPU_CORES}
sudo make install/strip # strip removes all debug info on installing
sed -i "s#Exec=#Exec=env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib#" /usr/local/share/applications/gnucash.desktop # This adds LD_LIBRARY_PATH to the GnuCash application icon. This command line has not been tested yet

 

# To start gnucash (or just open the application icon)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
gnucash