Yes you can install it on localhost.
rl localhost:9200 If not installed then: sudo apt update
Then run the installation: sudo apt install elasticsearch
First, reload the systemd configuration: sudo systemctl daemon-reload
Then, enable the Elasticsearch service with: sudo systemctl enable elasticsearch.service
And finally, after the service is enabled, start ...
If you use Nginx please give me your Nginx config.
Maybe It's happening by your Nginx configuration with php-fpm.
You can verify by yourself with echo phpinfo(); in /pub/index.php to check your PHP version running with Webserver.
I Check and found the solution that,
When I need to switch the PHP Version from 7.2 to 7.4 I need to run the command like this one.
sudo a2dismod php7.2
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart
You might just need to enable the module first.
bin/magento module:enable Module_Name
This will update your config.php file and activate the module.
You can check your module status in the data table setup_module
A simple Solution:
When you use php -v on shell, it will tell you which PHP version cli is using. But the composer could have use different php version if you have multi php installed.
To run composer with your desired php version, you can use this command
/usr/bin/php7.4 /usr/local/bin/composer update
or any other composer command with php version.
Please Check .htaccess file is available in pub/static folder.If you don't have that file than you can download it from https://github.com/magento/magento2/tree/2.4-develop/pub/static and upload in your directory pub/static.