Sometimes the installation will fail because Magento doesn’t have sufficient permissions to write to the necessary web server directories. There are multiple ways to fix this.
1.Easiest way but not secure: Just give the 777 permission to your Extension folders and try uploading again.
2.Linux Permissions: Your apache user:group in linux and the folder permissions of your magento should match. e.g if your cPanel/ftp username/ssh user is "etech". You need to check which group this user belongs to. Suppose "etech" user belongs to group "company". In this case add "www-data" or "apache" group to "company" group as well. This is a bit complex to solve and require good knowledge of linux permission system.