I am installing Moodle 3.1 on a Centos 7 server. When installing Moodle through the browser I receive this error. Data directory (/var/www/moodledata) cannot be created by the installer.
these are the commands I entered on the server:
cd /var/www
mkdir moodledata
sudo chmod -R 755 /var/www/moodledata
sudo chown _r apache:apache /var/www/moodledata
Your last command should be:
sudo chown -R apache:apache /var/www/moodledata
The -R means recursive.
Other things on CentOS 7 to check:
SELinux ... new servers have this running by default. Suggest setting to 'permissive' so that you can see what it's complaining about and fix things one at a time ... slowly.
Manually edit /etc/selinux/config
sudo nano /etc/selinux/config
Set the line: SELINUX = permissive
Save the file.
Reboot the box ... one of the few times one needs to reboot.
Oh ... might need to install nano (a text editor that is more user friendly than vi) if not present.
sudo install nano
'spirit of sharing', Ken