How To install Drupal 7 on Fedora Linux

I got stuck for a few house installing Drupal 7 on my server.  I am running Fedora Core 14 with SE Linux enabled.  I usually turn off SE Linux because it is a hassle, but on this server I am leaving it on to practice keeping security tight.

During the Drupal install I kept getting write permissions errors on my settings.php file and sites/default/files directory.  I am running my Drupal in a directory out side of the default /var/www/html because I have a large partition in /home.  The steps below fixed my permission problems.  i had to log out of Fedora (using GUI) to see the SE Linux alerts.

4. Step 4: Setup Drupal

At this point you should have a DocumentRoot directory ready. In this guide we use /var/www/http. At this point we need to ensure that Drupal installation files have a correct SELinux context. If you have completed step 3 as described you are almost ready to proceed with installation. But first we need to create settings file from the default.settings.php file:

# cd /var/www/html/sites/default/

# cp -p default.settings.php settings.php

Almost there ! Drupal wants to have  /var/www/html/sites/ and /var/www/html/sites/default/settings.php writable. When dealing with SELinux we need to update context of the /var/www/html/sites/ to read and write:

# chcon -R -t httpd_sys_content_rw_t /var/www/html/sites/

If you have moved or copied Drupal installation files make sure that:

all files belong to Apache user

you set SELinux context with chcon -R -t httpd_sys_content_t /var/www/html/

you have changed SELinux context of /var/www/html/sites/ with the above command

NOTE:

to check a SELinux context use ls command with -Z option.

Example:

# ls -Z settings.php

-r–r–r–. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 settings.php

For files copied from ~/ you may have wrong context as:

# ls -Z default.settings.php

-rw-r–r–. 6226 6226 unconfined_u:object_r:user_home_t:s0 default.settings.php

via How To install Drupal 7 on Fedora Linux.