Generally speaking, OpenFOAM runs natively on Linux. You need to use Linux environment one way or another if you want to use OpenFOAM. Although there are OpenFOAM binary (executable) files for Windows operating systems, most of them are of limited functionality or commercial solvers. On the other hand, Windows Subsystem for Linux (WSL) is another easy alternative and you can find it here.
In this tutorial, we will guide you through Linux installation process on your computer.
Installing Linux operating system on your computer may sound intimidating but it is quite an easy task. Anyway, in this tutorial, I will explain how to do it on your computer by using virtual machine. Using virtual machines can be an easier way if you want to try installing Linux on your computer without the risk of breaking anything. You do not need to worry about formatting the wrong partition (your main Windows partition) or messing up with your BIOS during boot sequence change.
Either you install natively (dual booting) or through a virtual machine, the installation is fundamentally the same. But if you want to install via a virtual machine, you need to download and install one first.
Ubuntu Installation Steps on VirtualBox
- Download and install VirtualBox
- Download Ubuntu 22.04 LTS ISO file
- Attach the ISO to VirtualBox
- Install Ubuntu operating system
1.Download and install VirtualBox
So, the first thing you need to do is to install your virtual machine software. VirtualBox is my go-to software for testing various operating systems. It is open source and contains features for your baseline testing purposes. So, you do not need to worry about the costs and licensing limitations as long as you are using it for personal purposes.
VirtualBox download is very simple. You go to virtualbox.org (here)and download the latest VirtualBox installer. Now you have the installer in your Downloads folder. Run as an administrator and follow along with the installation steps.
2. Download Ubuntu 22.04 LTS ISO image
After finishing your VirtualBox installation, we need to download Ubuntu ISO image. I chose Ubuntu because it is very beginner friendly and most of the time, you do not need to care about small details. And I selected Ubuntu 22.04 LTS, because it has long term support. Therefore, your driver or security issues are covered in the future.
You can download Ubuntu 22.04 LTS from here (https://ubuntu.com/download/desktop).
The ISO file is a large file (4.7GB) and you need to store temporarily somewhere. You may want to move from Downloads folder to your larger hard drive if your main SSD drive is small.
3. Attach the ISO image to VirtualBox
Now open your VirtualBox. It would be like the above figure. Click New to create your new virtual machine with Ubuntu operating system.
Now you need to fill in the above fields. I chose name as Ubuntu-test but for you, any suitable name you want is OK. In the ISO image dropdown list, choose Other and then find the Ubuntu 22.04 ISO file you downloaded.
Since we are installing Linux, it is categorized as Unattended Guest OS. Anyway, we need to provide our username and password to be for your Ubuntu OS inside VirtualBox.
Then, you need to setup memory and processor as well as hard disk size for your virtual machine. Then it will show the summary of your virtual machine and you just click Finish.
4. Install Ubuntu
Finally, it’s time to install Ubuntu! Now select your virtual machine and click Start button.
When you see bootloader, just select Try or Install Ubuntu and press Enter. Ubutntu will load and prepare for your use.
The process is very automatic and you just need to wait for a while. After that, there will be a login screen and you can login and use your Ubuntu now!
Now you are ready to dive into the realm of Linux command lines. In order to install/compile OpenFOAM, you need to prepare your newly installed Ubuntu. You can find the necessary requirements for OpenFOAM for smooth installation, here.