1、虚拟机
我这里使用的是开源linux系统Ubuntu22.0,可以使用VMware来安装。自行百度
2、添加镜像源并更新
打开sources.list文件
sudo gedit /etc/apt/sources.list
删除全部内容,添加清华镜像源。
链接:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
更新源
sudo apt update
如果源使用不对,可能会出现工具版本不对应的问题
4、依赖安装
sudo apt-get install -y build-essential flex bison git-core cmake zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev
5、安装openfoam
cd $HOME // 进入Home文件夹
mkdir OpenFOAM // 创建OpenFOAM文件夹
cd OpenFOAM // 进入OpenFOAM文件夹
git clone https://e.coding.net/dyfluid/OpenFOAM/OpenFOAM-9.git && git clone https://e.coding.net/dyfluid/OpenFOAM/ThirdParty-9.git // 克隆openfoam
将openfoam添加到源文件
source OpenFOAM-9/etc/bashrc &&
cd OpenFOAM-9 &&
./Allwmake -j &&
sed -i '$a source $HOME/OpenFOAM/OpenFOAM-9/etc/bashrc' $HOME/.bashrc
标签:01,openfoam9,universe,安装,jammy,https,ubuntu,multiverse,restricted
From: https://www.cnblogs.com/dbai/p/17267056.html