From Gentoo Wiki
Jump to:navigation Jump to:search
This page contains changes which are not marked for translation.

This article has been flagged for not conforming to the wiki guidelines (use of 2nd person pronouns, not following blueprint). Please help Gentoo out by starting fixing things.

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


The Drupal package installs everything you need except a database server. However, some configuration is best done before installing. And some packages might be used for more things than Drupal and hence should be installed separately.

USE flags

If you plan to use the default webserver, Apache 2, edit /etc/portage/make.conf and add "apache2" to your USE flags.

FILE /etc/portage/make.confPortage configuration file
USE="... apache2 ..."

Then add the needed USE flags for PHP. Edit /etc/portage/package.use and add "gd mysql mysqli pdo" to the PHP specific USE flags.

FILE /etc/portage/package.usePortage configuration file
dev-lang/php gd mysql mysqli pdo

If you plan to use PostgreSQL instead of the default MySQL / MariaDB, add "postgres".


You must install a database server unless you are planning to use an already existing (remote) server. Use MariaDB (or MySQL).

root #emerge --ask dev-db/mariadb

You must also configure the database server by rerunning the prior command with the --config option.

root #emerge --ask --config dev-db/mariadb

If you plan to use a webserver for other things than Drupal, install it separately.

root #emerge --ask www-servers/apache

if you want to use Apache.

If you need PHP for other web applications, install it separately too.

root #emerge --ask dev-lang/php

PS! To enable PHP in Apache, edit /etc/conf.d/apache2 and add -D PHP to your APACHE2_OPTS line. You might also want to check out PHP_TARGETS

Controlling your LAMP stack

Start up your LAMP stack

root #rc-service mysql start
root #rc-service apache2 start

Set the LAMP stack to start upon boot

root #rc-update add mysql default
root #rc-update add apache2 default

If you use systemd, modify the commands above.



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.accept_keywords.

FILE /etc/portage/package.accept_keywordsPortage configuration file


Now, install the package:

root #emerge --ask drupal

Run webapp-config manually to actually install the files for the webserver:

root #webapp-config -h localhost -u apache -d /drupal -I drupal 8.8.1

This command installs Drupal in the "drupal" subdirectory of the default vhost. If desired, change "localhost" to the hostname of another virtual host/website, and "8.8.1" to the desired Drupal version..

webapp-config can be used to install multiple Drupal sites (based on the same Gentoo package that was just emerged).

Configure a database

You need to create a database, a database user and give that user the correct permissions on the database tables. The needed SQL code depends on the Drupal version you installed and the database server you selected.

Hence, read the "Create the database" section of the "Installing Drupal" documentation (on drupal.org) - for Drupal 8 or Drupal 7. You should read the subsection about (SQL) commands / the command line.

Configure Drupal

The normal way to configure (or install) Drupal, is to visit your website in a browser and follow the instructions. Go to


which will redirect you to the Drupal installer. (You can configure Drupal from the command line using Drush if you prefer.)

Read the Drupal documentation for help and tips - for Drupal 9+ or Drupal 7.

Release notes: