Install Drupal 7

Now that you've got all the pieces in place, let's install and configure Drupal 7. Go to the Drupal Installation Guide for detailed installation instructions.

Create settings.php and write-enable for the Drupal installer:

sudo cp /var/www/www.example.com/sites/default/default.settings.php /var/www/www.example.com/sites/default/settings.php
sudo chmod a+w /var/www/www.example.com/sites/default/settings.php

Set user and group ownership for all Drupal files and directories:

sudo chown -R root.www-data /var/www/www.example.com

Create the "files" and "private" directories, set permissions and ownership:

sudo mkdir -p /var/www/www.example.com/sites/default/files/private
sudo chown root.www-data /var/www/www.example.com/sites/default/files
sudo chmod 775 /var/www/www.example.com/sites/default/files
sudo chown root.www-data /var/www/www.example.com/sites/default/files/private
sudo chmod 770 /var/www/www.example.com/sites/default/files/private

Disable public access to Drupal documentation files:

sudo find /var/www/www.example.com -name '[A-Z]*.txt' -exec chmod o-r {} \;

Open a browser and go to www.example.com/install.php to run Drupal's install wizard. Be sure to use the database name, username and password you selected during the MySQL installation.

Once you have completed the Drupal installation wizard, remove write permissions to protect the default directory and settings.php file:

sudo chmod 755 /var/www/www.example.com/sites/default
sudo chmod 555 /var/www/www.example.com/sites/default/settings.php

Congratulations! You should now have a fully functional Drupal installation ready to rock.

Find an error? Know a better way? Please leave a comment and help improve this cookbook.