Monthly Archives: May 2014

Qwt 6 standalone install

Download qwt-6.0.2.tar.bz2 from http://qwt.sourceforge.net/
module load qt/4.8.6 # from qt-installation
in qwtconfig.pri: QWT_INSTALL_PREFIX    = /opt/qwt/$$QWT_VERSION
qmake qwt.pro
make -j4
make install

module file /etc/modulefiles/qwt/6.0.2:

#%Module1.0############################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis “Add program links, aliases and paths”

## Add directory to the path
prepend-path LD_LIBRARY_PATH /opt/qwt/6.0.2/lib:/opt/qwt/6.0.2/plugins/designer
prepend-path CPLUS_INCLUDE_PATH /opt/qwt/6.0.2/include

## Set environment variables
setenv QWT_INCLUDEPATH “/opt/qwt/6.0.2/include”
setenv QWT_LIBPATH “/opt/qwt/6.0.2/lib”
setenv QWT_LIBS “-lqwt”

Standalone QT 4.8 installation on Centos

Download qt-everywhere-opensource-src-4.8.6.tar.gz from http://download.qt-project.org

./configure -prefix /opt/qt/4.8.6 -prefix-install -release -opensource
gmake -j 4 # if you have 4 cores…
gmake install

module file /etc/modulefiles/qt/4.8.6:

#%Module1.0###############################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis “Add program links, aliases and paths”

setenv QT4_ROOT_DIR “/opt/qt/4.8.6”
setenv QT_PLUGIN_PATH “/opt/qt/4.8.6/plugins”
prepend-path PATH /opt/qt/4.8.6/bin
prepend-path LD_LIBRARY_PATH /opt/qt/4.8.6/lib

Standalone install of python 2.7 and 3.4 on CentOS

Download Python-2.7.6.tgz and Python-3.4.1.tar.xz. Unpack the xz-file with tar -xJvf Python-3.4.1.tar.xz. We use the standalone tcltk-installation we’ve made already… (here)

Python 2.7.6
./configure –prefix=/opt/python/2.7.6 –exec-prefix=/opt/python/2.7.6 –oldincludedir=/opt/python/2.7.6/include –datadir=/opt/python/2.7.6 –docdir=/opt/python/2.7.6/doc –with-system-ffi –with-tcltk-includes=”-I/opt/tcltk/8.5.13/include” –with-tcltk-libs=”-L/opt/tcltk/8.5.13/lib -ltcl8.5 -ltk8.5″ –with-pth

make -j4
make install

Module file /etc/modulefiles/python/2.7.6:

#%Module1.0##################################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis “Add program links, aliases and paths”

setenv PYTHON_ROOT_DIR “/opt/python/2.7.6”
setenv PYTHONHOME “/opt/python/2.7.6”
setenv PYTHON_VERSION “2.7”
setenv PYTHON_INCLUDE /opt/python/2.7.6/include/python2.7
prepend-path PATH /opt/python/2.7.6/bin
prepend-path LD_LIBRARY_PATH /opt/python/2.7.6/lib
prepend-path PYTHONPATH /opt/python/2.7.6/lib/python2.7

Python 3.4.1
./configure –prefix=/opt/python/3.4.1 –exec-prefix=/opt/python/3.4.1 –oldincludedir=/opt/python/3.4.1/include –datadir=/opt/python/3.4.1 –docdir=/opt/python/3.4.1/doc –with-system-ffi –with-tcltk-includes=”-I/opt/tcltk/8.5.13/include” –with-tcltk-libs=”-L/opt/tcltk/8.5.13/lib -ltcl8.5 -ltk8.5″

make -j4
make install

module file /etc/modulefiles/python/3.4.1

#%Module1.0#########################################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis “Add program links, aliases and paths”

set-alias “xmlwf” “xmlwf21”
set-alias “python” “python3”
set-alias “idle” “idle3”
set-alias “pip” “pip3”
set-alias “pydoc” “pydoc3”
set-alias “python-config” “python3-config”
set-alias “f2py” “f2py3”

setenv PYTHON_ROOT_DIR “/opt/python/3.4.1”
setenv PYTHONHOME “/opt/python/3.4.1”
setenv PYTHON_VERSION “3.4”
setenv PYTHON_INCLUDE /opt/python/3.4.1/include/python3.4
prepend-path PATH /opt/python/3.4.1/bin
prepend-path LD_LIBRARY_PATH /opt/python/3.4.1/lib
prepend-path PYTHONPATH /opt/python/3.4.1/lib/python3.4

Tcltk standalone install

Download tcl8.5.13-src.tar.gz and tk8.5.13-src.tar.gz from http://sourceforge.net/projects/tcl

Tcl
./configure –prefix=/opt/tcltk/8.5.13 –exec-prefix=/opt/tcltk/8.5.13 –oldincludedir=/opt/tcltk/8.5.13/include –enable-threads
make -j4
make install

Tk
./configure –prefix=/opt/tcltk/8.5.13 –exec-prefix=/opt/tcltk/8.5.13 –oldincludedir=/opt/tcltk/8.5.13/include
make -j4
make install

Module-file /etc/modulefiles/tcltk/8.5.13
#%Module1.0####################################################################
##
## Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis “Add program links, aliases and paths”

## Set alias
set-alias “tclsh” “tclsh8.5”
set-alias “wish” “wish8.5”

setenv TCLHOME “/opt/tcltk/8.5.13”
setenv TCLLIBPATH “/opt/tcltk/8.5.13/lib:/opt/tcltk/8.5.13/lib/tcl8.5”
prepend-path PATH /opt/tcltk/8.5.13/bin
prepend-path LD_LIBRARY_PATH /opt/tcltk/8.5.13/lib

Module install of Scons build system used by Cantera

module load python/2.7.6
python setup.py build
python setup.py install –prefix /opt/scons/2.3.1 –standalone-lib

Create a module file /etc/modulefiles/scons/2.3.1
#%Module1.0##########################################
##
##  Discretizer AB modulefile
##
##
proc ModulesHelp { } {
puts stderr “\tAdd environment.”
}

## Create a whatis file.
module-whatis   “Add program links, aliases and paths”

## Add directory to the path
prepend-path    PATH    /opt/scons/2.3.1/bin

prepend-path          PYTHON_PATH  /opt/scons/2.3.1/lib
prepend-path          PYTHONPATH   /opt/scons/2.3.1/lib

Let tigerVNC through firewall

replace /etc/sysconfig/iptables with:

/etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp -m multiport –dports 5901:5903,6001:6003 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT

.. and then /etc/init.d/iptables restart

If you need more vnc-sessions than 3 adjust ports accordingly:
example -> 5901:5909,6001:6009

http://wiki.centos.org/HowTos/VNC-Server

Don’t forget to activate vncconfig in ~/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -display :1nowin&

 

Create module file

Investigate environment before and after you run a env-script
> env | sort > envbefore
> . somescript
> env | sort > envafter
diff envbefore envafter > initialmodulefile

vim commands:
:s/>/setenv  /g 100
:s/=/   “/g 100
:s/\n/\”\r/g 100

Or sed/perl a little…
sed -i ‘s/>/setenv /g’ initialmodulefile
sed -i ‘s/=/   “/g’ initialmodulefile
#sed -i ‘s/\n/”\r/g’ initialmodulefile   this doesn’t work
perl -i -p -e ‘s/\n/”\n/’ initialmodulefile

http://wiki.ibest.uidaho.edu/index.php/Tutorials:_Creating_your_own_modulefiles

Create aliases in module file
> alias | sort > aliasbefore
> . somescript
> alias | sort > aliasafter
diff aliasbefore aliasafter > initialalias
sed -i ‘s/>//g’ initialalias
sed -i ‘s/alias /set-alias “/’ initialalias
in vim:
:s/=’/” “/g 100
:s/’/”/g 100

replace $ with \$

change to any user in the module file for openfoam:

set home $env(HOME)
set user $env(USER)
:s/\/root\/OpenFOAM\/root-2.4.0/$home\/OpenFOAM\/$user-2.4.0/g 1000

Install OpenFOAM 2.2x and 2.3.x on a CentOS 6.5

Download OpenFOAM-2.2.x.tar.gz and OpenFOAM-2.3.x.tar.gz from http://sourceforge.net/projects/centfoam

install in /opt/OpenFOAM/
$ ls /opt/OpenFOAM –> OpenFOAM-2.2.x  OpenFOAM-2.3.x  ThirdParty-2.2.x  ThirdParty-2.3.x

source normally or create module files: /etc/modulefiles/openfoam/2.2.x and 2.3.x
they look like (just execute the command module load openfoam/2.2.x before using that OpenFOAM version.

#%Module1.0####################################################################
##
##  openfoam/2.2.x modulefile
##
##  
##
proc ModulesHelp { } {
puts stderr “\tAdd OpenFOAM 2.2.x environment by Björn Bergqvist.”
}

module-whatis   “Adds OpenFOAM 2.2.x links, aliases and paths”

set home $env(HOME)
set user $env(USER)

## Add my bin directory to the path
append-path     PATH    /opt/OpenFOAM/ThirdParty-2.2.x/platforms/linux64Gcc/gperftools-svn/bin:/opt/OpenFOAM/ThirdParty-2.2.x/platforms/linux64Gcc/openmpi-1.7.2/bin:/opt/OpenFOAM/ThirdParty-2.2.x/platforms/linux64/gcc-4.7.2/bin:$home/OpenFOAM/$user-2.2.x/platforms/linux64GccDPOpt/bin:/opt/OpenFOAM/site/2.2.x/platforms/linux64GccDPOpt/bin:/opt/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/bin:/opt/OpenFOAM/OpenFOAM-2.2.x/bin:/opt/OpenFOAM/OpenFOAM-2.2.x/wmake

## Set an environment variable
setenv   FOAM_APPBIN   “/opt/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/bin”
setenv   FOAM_APP   “/opt/OpenFOAM/OpenFOAM-2.2.x/applications”
setenv   FOAM_EXT_LIBBIN   “/opt/OpenFOAM/ThirdParty-2.2.x/platforms/linux64GccDPOpt/lib”
setenv   FOAM_INST_DIR   “/opt/OpenFOAM”
setenv   FOAM_JOB_DIR   “/opt/OpenFOAM/jobControl”
setenv   FOAM_LIBBIN   “/opt/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib”
setenv   FOAM_MPI   “openmpi-1.7.2”
setenv   FOAM_RUN   “$home/OpenFOAM/$user-2.2.x/run”

Update: recompile openmpi
I got a problem with mpirun on my 2.2.x installation so I had to recompile openmpi

Update: Errormessage:

$ mpirun -np 4 simpleFoam -parallel
————————————————————————–
It looks like opal_init failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during opal_init; some of which are due to configuration or
environment problems. This failure appears to be an internal failure;
here’s some additional information (which may only be relevant to an
Open MPI developer):

opal_shmem_base_select failed
–> Returned value -1 instead of OPAL_SUCCESS
————————————————————————–
————————————————————————–
It looks like orte_init failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems. This failure appears to be an internal failure;
here’s some additional information (which may only be relevant to an
Open MPI developer):

opal_init failed
–> Returned value Error (-1) instead of ORTE_SUCCESS
————————————————————————–

Problem solution

module load openfoam/2.2.x
cd /opt/OpenFOAM/ThirdParty-2.2.x
rm -r platforms/linux64Gcc/openmpi-1.7.2
./Allwmake

and

module load openfoam/2.3.x
cd /opt/OpenFOAM/ThirdParty-2.3.x
rm -r platforms/linux64Gcc/openmpi-1.6.5/
./Allwmake

Vim as default in CentOS

alternatives –install /usr/bin/vi vi /usr/bin/vim 900

alternatives –display vi
output:
vi – status is auto.
link currently points to /usr/bin/vim
/usr/bin/vim – priority 900
Current `best’ version is /usr/bin/vim.

 

to remove:

update-alternatives –remove vi /usr/bin/vim