Guide for installing Magento 2.4.x in Ubuntu 20.04
Check the requirements using this link
https://www.mageplaza.com/kb/
For installing PHP please follow this link:
https://computingforgeeks.com/
and you need this mcrypt extension and you have to manually install this by following this link:
https://computingforgeeks.com/
During Installation follow this link as general steps.
https://www.mageplaza.com/
Magento 2 needs you to setup and configure Varnish.
https://devdocs.magento.com/
Magento 2 also needs you to setup and configure ElasticSearch.
** You may possibly experience some issues with Elasticsearch memory problem so I would suggest you try to increase the RAM if that happen.