Drupal

From Gentoo Wiki
Jump to: navigation, search
Resources

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

Preinstall

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.

Packages

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

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.

Install

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

FILE /etc/portage/package.accept_keywordsPortage configuration file
www-apps/drupal

Emerge

Now we can get on with emerging:

root #emerge --ask drupal

You will have to run webapp-config manually to actually install the files for the webserver:

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

This command installs Drupal in the "drupal" subdirectory of the default vhost. You may change "localhost" to the hostname of another virtual host/website.

You can use webapp-config to install multiple Drupal sites (based on the same Gentoo package that you 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

http://localhost/drupal/

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 8 or Drupal 7.