Skip to content

Instantly share code, notes, and snippets.

@residential-map-machine-user
Last active May 15, 2021 22:24
Show Gist options
  • Save residential-map-machine-user/39a924f97381d731ed2ce43eb1343ccd to your computer and use it in GitHub Desktop.
Save residential-map-machine-user/39a924f97381d731ed2ce43eb1343ccd to your computer and use it in GitHub Desktop.
openfoam 2.4.0 setup shellscript
#!/bin/bash
#====================================================================
# aptのアップデート
#====================================================================
yes | sudo apt-get update
yes | sudo apt-get upgrade
#====================================================================
# 『デスクトップ』『音楽』などの日本語フォルダー名を英語表記にする
#====================================================================
env LANGUAGE=C LC_MESSAGES=C xdg-user-dirs-gtk-update
#====================================================================
# デスクトップがフリーズした場合に備えて「Ctrl+Alt+Backspace」で強制終了を有効化
#====================================================================
#sudo dpkg-reconfigure keyboard-configuration
#====================================================================
# 文字化け対策
#====================================================================
gsettings set org.gnome.gedit.preferences.encodings auto-detected "['UTF-8','CURRENT','SHIFT_JIS','EUC-JP','ISO-2022-JP','UTF-16']"
gsettings set org.gnome.gedit.preferences.encodings shown-in-menu "['UTF-8','SHIFT_JIS','EUC-JP','ISO-2022-JP','UTF-16']"
#====================================================================
# プラグインの追加
#====================================================================
yes | sudo apt-get install gedit-plugins
#====================================================================
# Ubuntu Web Apps(Gmail/Amazon/Twitter/Facebook)削除
#====================================================================
yes | sudo apt-get remove unity-webapps-common xul-ext-unity xul-ext-websites-integration
#====================================================================
# updatedbの無効化(locateコマンド使わないなら絶対しておくべき)
#====================================================================
sudo chmod 644 /etc/cron.daily/mlocate
#もとに戻すならsudo chmod 755 /etc/cron.daily/mlocate
#====================================================================
# ソフトウェアインストール
#====================================================================
# 便利ツール
yes | sudo apt-get install tree curl
#yes | sudo apt-get install git
yes | sudo apt-get install vim vim-gnome
yes | sudo apt-get install imagemagick pdftk
yes | sudo apt-get install flashplugin-installer
# heroku-toolbelt
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
#====================================================================
# Python開発環境構築
#====================================================================
yes | sudo apt-get install python-pip python2.7 python2.7-dev python3
yes | sudo pip install virtualenv
yes | sudo pip install virtualenvwrapper
## Virtualenvwrapper
#if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
# export WORKON_HOME=$HOME/.virtualenvs
# source /usr/local/bin/virtualenvwrapper.sh
#fi
#====================================================================
# pipで入れれる便利ツール
#====================================================================
# trash-cli : http://tukaikta.blog135.fc2.com/blog-entry-214.html
yes | sudo pip install trash-cli
#====================================================================
# その他
#====================================================================
echo 'その他にインストールするもの'
#echo 'Pycharm'
echo 'dropbox'
echo 'virtualbox,vagrant : http://qiita.com/seizans/items/ef220c98fde6dbfbee32'
yes | sudo apt-get install zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
yes | sudo apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev libqtwebkit-dev gnuplot \
libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin libboost-system-dev libboost-thread-dev libgmp-dev \
libmpfr-dev python python-dev
yes | sudo apt-get install libglu1-mesa-dev libqt4-opengl-dev
cd $HOME
mkdir OpenFOAM
cd OpenFOAM
wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.4.0.tgz?use_mirror=mesh" -O OpenFOAM-2.4.0.tgz
wget "http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz?use_mirror=mesh" -O ThirdParty-2.4.0.tgz
tar -xzf OpenFOAM-2.4.0.tgz
tar -xzf ThirdParty-2.4.0.tgz
ln -s /usr/bin/mpicc.openmpi OpenFOAM-2.4.0/bin/mpicc
ln -s /usr/bin/mpirun.openmpi OpenFOAM-2.4.0/bin/mpirun
source $HOME/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc WM_NCOMPPROCS=4
echo "alias of240='source \$HOME/OpenFOAM/OpenFOAM-2.4.0/etc/bashrc $FOAM_SETTINGS'" >> $HOME/.bashrc
source $HOME/.bashrc
of240
cd $WM_THIRD_PARTY_DIR
#make very certain that the correct Qt version is being used, by running this command:
export QT_SELECT=qt4
# This next command will take a while... somewhere between 5 minutes to 30 minutes.
./Allwmake > log.make 2>&1
export QT_SELECT=qt4
sed -i -e 's=//#define GLX_GLXEXT_LEGACY=#define GLX_GLXEXT_LEGACY=' \
ParaView-4.1.0/VTK/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx
cd $WM_THIRD_PARTY_DIR/ParaView-4.1.0
wget http://www.paraview.org/pipermail/paraview/attachments/20140210/464496cc/attachment.bin -O Fix.patch
patch -p1 < Fix.patch
cd VTK
wget https://github.com/gladk/VTK/commit/ef22d3d69421581b33bc0cd94b647da73b61ba96.patch -O Fix2.patch
patch -p1 < Fix2.patch
cd ../..
./makeParaView4 -python -mpi -python-lib /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 > log.makePV 2>&1
#Go into OpenFOAM's main source folder
cd $WM_PROJECT_DIR
#Still better be certain that the correct Qt version is being used
export QT_SELECT=qt4
# This next command will take a while... somewhere between 30 minutes to 3-6 hours.
./Allwmake > log.make 2>&1
#Run it a second time for getting a summary of the installation
./Allwmake > log.make 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment