I am having following error when try to install Magento 2.1.7
Fatal error: Uncaught Magento\Framework\Exception\FileSystemException: The file "/opt/lampp/htdocs/magento2/var/.regenerate" cannot be deleted Warning!unlink(/opt/lampp/htdocs/magento2/var/.regenerate): Permission denied in /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Driver/File.php:382 Stack trace: #0 /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Directory/Write.php(172): Magento\Framework\Filesystem\Driver\File->deleteFile('/opt/lampp/htdo...') #1 /opt/lampp/htdocs/magento2/vendor/magento/framework/Code/GeneratedFiles.php(98): Magento\Framework\Filesystem\Directory\Write->delete('/var/.regenerat...') #2 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/ObjectManagerFactory.php(114): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles() #3 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/Bootstrap.php(385): Magento\Framework\App\ObjectManagerFactory->create(Array) #4 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/Bootstrap.php(362): Magento\Framework\App\Bo in /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Driver/File.php on line 382
php magento setup:install
--admin-firstname=John
--admin-lastname=Smith
--admin-email=jsmith@mail.com
--admin-user=admin
--admin-password=password1
--base-url=http://magento.local/
--db-host=localhost
--db-name=magento
--db-user=magento
--db-password=magento
--currency=USD
--timezone=America/Chicago
--language=en_US
--use-rewrites=1
This error shows when you do not have created DB and connection with same.
– iva Apr 18 '18 at 10:42