Install GnuCash 3.3 on CentOS 7

These instructions will assist you in installing GnuCash 3.3 on CentOS Linux 7. These instructions will also work for the older GnuCash version 3.2.

Unfortunately, installing GnuCash 3 onto CentOS 7 is not as straight forward as installing the package (as it was for the older GnuCash 2 versions). This is due to newer required OS libraries that are/will not be shipped on CentOS 7 (like cmake or boost). So you have to compile the new libraries yourself and run them in parallel to the OS libraries. The overall process can take some hours, depending on your computer speed.

Have a look...

yum update # Get the latest updates just in case...

# let's start with building cmake
cd /tmp
yum -y install gcc-c++
wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1.tar.gz
tar xf cmake*.tar.gz
cd cmake*
./bootstrap && make && make install

# Install boost 1.69 (latest at the time of writing this document. required is only 1.54)
cd /tmp
yum -y install gcc-c++ python-devel
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2
tar xfj boost*.tar.bz2
cd boost_*
./bootstrap.sh
./b2
./b2 install
export BOOST_ROOT=/tmp/boost_1_68_0

# now off to compile gnucash

cd /tmp
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # install EPEL
yum -y install glib2-devel libxml2-devel libxslt-devel webkitgtk4-devel guile-devel gwenhywfar-devel aqbanking-devel ktoblzcheck-devel libofx-devel libsecret-devel libdbi-devel libdbi-dbd-mysql gtest-devel gmock-devel  iso-codes-devel
wget https://sourceforge.net/projects/gnucash/files/gnucash%20%28stable%29/3.3/gnucash-3.3.tar.bz2
tar -xjf gnucash*
mkdir build-gnucash-3.3
cd build-gnucash-3.3
export BOOST_ROOT=/tmp/boost_1_68_0
# Option 1: Without Python bindings
/usr/local/bin/cmake ../gnucash-3.3 # this is where cmake was put from the previous section
# Option 2: With Python plugin and bindings.
yum -y install python34-devel
/usr/local/bin/cmake -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3.4 -DWITH_PYTHON=ON ../gnucash-3.3 # this is where cmake was put from the previous section

# Both options:
make
make install/strip # strip removes all debug info on installing

ln -s /usr/local/lib64/python3.4/site-packages/gnucash /usr/lib64/python3.4/site-packages/gnucash # Optional: do this if you want to use the python libraries in your custom code

# To start gnucash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib # you have to do this every time. See my comment in the section LD_LIBRARY_PATH below
gnucash

This should be it. If this was helpful for you, please click and view some of the ads on my page.

Comment on LD_LIBRARY_PATH

I intentionally did not add /usr/local/lib to the global library path to keep aligned with RedHat/CentOS as a long term stable strategy. One of the reasons to use Red Hat/CentOS is to have a reliable and stable system. The drawback is the lack of latest versions for many components (leading us to manually compile GnuCash, boost and cmake instead of using out of the box packages).  Now when adding our self-compiled, latest boost version to the global path will directly impact all other applications that are using the boost library (or in the /usr/local/lib folder) and depend on/tested on the built in version.

If you do accept the risk and would like to add the library path to your global settings, follow the below (untested by me) steps options. Option 1 is for real global settings. Option 2 is only for specific users (so you can use different users for different applications).

Option 1: True global setting

echo "/usr/local/lib" > /etc/ld.so.conf.d/gnucash.conf # I chose gnucash.conf as a file name to clearly mark the purpose. Maybe you want to chose local.lib.conf or anything else
ldconfig
# reboot might be required

Option 2: User specific

This really depends on the shell you are using (bash as default). If you are unsure, run "env | grep SHELL=" . For your own user, run this (add the above export line to the file):
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> ~/.bashrc # replace .bashrc with .<shell>rc if you use a different shell

For other users, use this command (replacing <username>)
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> ~<username>/.bashrc # replace .bashrc with .<shell>rc if you use a different shell