What should I write in hostname when I try to install a theme?

This happens when WordPress cannot directly (via php) create files inside the wp-content directory.

WordPress asks for FTP credentials to try and upload “manually” the files, you should provide the hostname of the ftp server (example: ftp.yourdomain.com), username and password. Of course you have to have an FTP server set up, which is usually straightforward on an shared hosting. If you are inside a self-hosted environment (i.e. VPS, AWS ec2 instance) you should solve this at the root of the problem:

To solve this you have to set as 755 the permissions to wp-content ( chmod -R 755 /you/html/root/wp-content) and make sure that the owner of the directory is the user as whom apache/nginx/php-fpm runs with the ls -l command.