Currently, supercomputing servers and individual servers are increasingly using the Ubuntu system, especially after the CentOS7 system, which is widely used, has stopped updating. When using the Windows system’s built-in subsystem for computational practice, the installation and acquisition of Ubuntu are more convenient and straightforward.
Installing VASP in the initial environment of Ubuntu requires configuring a suitable compilation environment, and there are different usage methods for the GCC and G++ compilers based on the system version.
This article references:
https://blog.csdn.net/snow5255/article/details/131147854
https://blog.csdn.net/u010420283/article/details/134735220
https://www.bilibili.com/opus/459956577539470449
First, update the system
sudo apt-get update
sudo apt-get upgrade
Install the default GCC for the system
sudo apt install gcc
sudo apt install g++
At the same time, install GCC version 9.5
sudo apt install gcc-9 # Install version 9
sudo apt install g++-9 # Install version 9
Change the default version of GCC used
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 40
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
Note: This example uses the highest GCC available on Ubuntu, which is only GCC-11. Version 24.0 of Ubuntu has already defaulted to GCC-13, please modify the code as necessary.
Check the default GCC version of the system
gcc --version
Note: If you are using Ubuntu version 20.0 or lower, the highest you can install is GCC version 9.4 or 9.3. This version will cause errors when installing VASP, as shown below:
/usr/include/c++/9/bits/stl_algobase.h(59): catastrophic error: cannot open
usr/include/c++/9/bits/stl_function.h(437): error: identifier “__builtin_is_
Or other issues.
In this case, you need to downgrade the GCC version to GCC-8
sudo apt install gcc-8
sudo apt install g++-8 # Install gcc-8, g++-8
Change the default version of GCC
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 # Downgrade GCC and G++ versions
If you encounter
catastrophic error: cannot open source file “bits/c++config.h” #include
Similar header file errors, you need to add a line to the environment variable
export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu/c++/8:$CPLUS_INCLUDE_PATH
Please ensure the .h file path is written accurately
This public account periodically publishes content related to DFT calculations, with varying and non-fixed themes.
Feel free to share this public account’s push notifications to spread the tutorial and experiences to those in need.
If you have questions about the tutorial content or need consultation, you can leave a message in the background or contact the author via WeChat: hn_87165
If you wish to join the public account group chat, you can also add the author and specify.
Or scan the QR code to add
When joining the group chat, please actively state: your unit and research direction

Finally, if you have experience related to DFT calculations and are willing to write related tutorials, you can also contact the author to submit.
Wishing you success

Metaphor Misleading Unduly Self-Deprecating