Drupal

Drupal is a powerful PHP content management system (CMS).

Preinstall
Edit /etc/portage/make.conf and add "apache2 php gd" to your use flags.

Edit /etc/portage/package.use and add "dev-lang/php mysql mysqli postgres" to PHP use flags then merge up LAMP.

PHP5 notes:

dev-lang/php5 must be built with pcre and session USE flags.

If you rebuild php5 changing flags you will need to restart apache2.

Scroll up into the emerge log and setup the root user for mysql running the command printed.

Edit /etc/conf.d/apache2 and add '-D PHP5' to your APACHE2_OPTS line.

Start up your LAMP stack

Set the LAMP stack to start upon boot

Unmask
At the time of writing, www-apps/drupal is masked as experimental only. If you run a "stable" system, you'll have to add it to your /etc/portage/package.keywords.

Install
Now we can get on with emerging:

If you have the vhosts USE flag set, you will have to run webapp-config manually.

where  is the FQDN (fully qualified domain name) hostname of your virtual host.

If you do not have the vhosts USE flag set, then webapp-config will get run for you during the emerge.

Create Drupal database
Drupal requires a bit of setup to get working. So here's what you'll need to do. Copy this script to your drupal/ directory. [Where is the drupal/ directory?]

Where 'passwd' is the password required to log in as the MySQL user.

Then execute the script:

This will create a new user 'drupal' and a database 'drupal' for your Drupal site and load the drupal database scheme.

Configure Drupal base options
Before you can run Drupal, you must set the database URL and the base URL to the web site. Open the configuration file and edit the line to match the database defined in the previous steps:

username and passwords are the ones you used with the GRANT command in mysql.

$db_url = 'mysql://drupal:passwd@localhost/drupal';

Drupal will make all links start with this, so make sure you are using something accessible to everyone. If you are installing drupal somewhere other than the root directory, add a slash followed by your directory within the quotation. Never leave a slash at the end.

$base_url = 'http://www.example.com';

Add Drupal entry to cron
Many Drupal modules have periodic tasks that must be triggered by a cron job. To activate these tasks, you must call the cron page. This will pass control to the modules and the modules will decide if and what they must do.

The following example crontab line will activate the cron script on the hour (you can edit the crontab with crontab -e:

0 * * * * wget -O - -q http://localhost/cron.php

You can now point your browser to http://localhost/install.php .. your drupal database will be setup, and you are ready to go!!

Installing Drupal modules
Installing and configuring modules for Drupal is a lot of fun. You can browse the list at http://drupal.org/project/Modules. Untar the packages to drupal/modules but remember, you have to update the database manually for most modules! Installation instructions come with the tar package.

For example, if you want to install the Daily module, and your user for mysql is drupal: