Install foam-extend 3.1 on CentOS 7

Preparation: 1. In order to install foam-extend 3.1, please make sure you have installed packages git, mercurial and subversion for source code retrieving, rpm-build for software packaging, gcc and g++ for compiling.

sudo yum install rpm-build gcc gcc-c++ libstdc++-devel binutils-devel

2. To install the third-party packages, you should have these packages installed: qt, qt-devel, qtwebkit and qtwebkit-devel for Paraview compiling and running, gcc-c++ and libc++-devel for openmpi, m4 for bison.

yum install m4 cmake qt qt-devel qtwebkit qtwebkit-devel flex

Installation 1. Download foam-extend 3.1 to the folder foam.

git clone

In default, the directory of foam-extend 3.1 is openfoam-extend-foam-extend-3.1, to make it shorter, you can change its name with

cd $HOME/foam
mv openfoam-extend-foam-extend-3.1 foam-extend-3.1

2. After you have downloaded the source code, you should modify some environmental variables in the file .bash_profile in your home directory.

vi ~/.bash_profile

Add the following line (variables) before the line PATH=....:

export QT_BIN_DIR=/usr/lib64/qt4/bin

Add the following line to the end of ~/.bashrc:

alias fe31='source $HOME/foam/foam-extend-3.1/etc/bashrc'

where $HOME/foam/foam-extend-3.1/ is the location of your foam-extend directory. And run those files with

. ~/.bash_profile
. ~/.bashrc

Then, run


to make the FOAM related variables effective.

3. Before you compile Third-party packages, run:


Otherwise, when you install swak4Foam, it will appear: helpers/printSwakVersion.H:46:21: fatal error: Pstream.H: No such file or directory #include "Pstream.H"

4. When you install the third-party packages, the PyFoam cannot be compiled. you should change the file AllMake.stage3, find the line:

    ( rpm_make -p PyFoam-0.6.3 -s PyFoam-0.6.3.spec  -u )

and change it as:

    ( rpm_make -p PyFoam-0.6.3 -s PyFoam-0.6.3.spec  -u -n PyFoam-0.6.3-1.noarch -a noarch)

Here, you should update the SPEC file for PyFoam, please find the lines in PyFoam-0.6.3.spec:

Source: 		%url/%{name}-%{version}-rc.tar.gz

and update with:

Source: 		%url/%{name}-%{version}.tar.gz

And update the following lines

%setup -q -n PyFoam-%{version}-rc


%setup -q -n PyFoam-%{version}

After you set all of the aboves right, you can run:


5. After you have compiled ThirdParty packages, you can compile the foam solvers and applications now:

cd ../
./Allwmake > make.log 2>&1 

./Allwmake > make.log 2>&1 makes a full log into make.log, including errors outputted during the compiling process (i.e. “2>&1” does the redirect of stderr to stdout). Now, so you should have a cup of coffee if your computer is fast enough, otherwise, you should hang out. Then you’ll get compiled foam. P.S. 1. If you don’t have gcc-c++ and libstdc++-devel installed, the compiling will give you an error: c++ preprocessor "/lib/cpp" fails sanity check 2. If you don’t have qtwebkit and qtwebkit-devel installed, the compiler will give you error when you compile paraview: [ 81%] Building CXX object Qt/Widgets/CMakeFiles/pqWidgets.dir/pqHelpWindow.cxx.o /pqHelpWindow.cxx:56:21: fata error: QWebPage: No such file or directory # include compilation terminated. Packages qtwebkit and qtwebkit-devel are stored in EPEL, you should install them from there.

sudo yum install

Then, you can install qtwebkit and qtwebkit-devel. 3. If you have not installed binutils-devel before you install FOAM, the following error will appear: -lspecie -lfoam -liberty -ldl -lrt -lm -o /home/abc/foam/foam-extend-3.1/applications/bin/linux64GccDPOpt/mixtureAdiabaticFlameT /usr/bin/ld: cannot find -liberty collect2: error: ld returned 1 exit status

One Reply to “Install foam-extend 3.1 on CentOS 7”

  1. If you find the following error:

    [[email protected] torque-4.2.10]$ sudo systemctl status pbs_server -l
    ● pbs_server.service - pbs-server
       Loaded: loaded (/usr/lib/systemd/system/pbs_server.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Sun 2019-06-09 16:16:35 CST; 13s ago
      Process: 119123 ExecStart=/usr/sbin/pbs_server (code=exited, status=3)
    Jun 09 16:16:35 nd1 systemd[1]: Starting pbs-server...
    Jun 09 16:16:35 nd1 pbs_server[119123]: pbs_server port already bound: Address already in use
    Jun 09 16:16:35 nd1 systemd[1]: pbs_server.service: control process exited, code=exited status=3
    Jun 09 16:16:35 nd1 systemd[1]: Failed to start pbs-server.
    Jun 09 16:16:35 nd1 systemd[1]: Unit pbs_server.service entered failed state.
    Jun 09 16:16:35 nd1 systemd[1]: pbs_server.service failed.

    You may find the port has been used.

    You can change the pbs port_num in /etc/services, to other port has not been used.
    Then execute

    sudo systemctl restart pbs_server pbs_mom pbs_sched trqauthd

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see


This site uses Akismet to reduce spam. Learn how your comment data is processed.