wiki:DrupalServer

Drupal 7

Assuming you installed your VM from the DrupalServer image:

  • dpkg-reconfigure drupal7
    • use drupal as the name of the database user.
  • a2enconf drupal7
  • service apache2 reload
  • cd /etc/drupal7/sites/default
  • mv settings.php default.settings.php

Create a baseurl.php file with the site's domain name, and proxy settings:

<?php
$base_url = 'http://demo2.faikvm.com/drupal7';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_header'] = 'HTTP_X_CLUSTER_CLIENT_IP';
$conf['reverse_proxy_addresses'] = array('10.0.2.51', '172.16.0.1');

Create a temporary settings.php including both dbconfig.php, and baseurl.php

<?php
include "base_url.php";
include "dbconfig.php";

Open up the web interface, and perform the install.

Enabling Clean URLs

  • a2enmod rewrite
  • service apache2 restart

edit /etc/drupal/7/htaccess, and change the RewriteBase? to /drupal7

Enabling Captchas

  • cd /usr/share/drupal7/modules
  • wget https://ftp.drupal.org/files/projects/captcha-7.x-1.x-dev.tar.gz
  • tar -xzf tar -xzf captcha-7.x-1.x-dev.tar.gz

Log into the web interface, and enable the 'Captcha' module.

Solr

We're going to install solr-tomcat, since it has many less dependencies in debian.

  • apt-get install solr-tomcat

Add the hostname of the localhost to the '127.0.0.1' line in /etc/hosts.

Copy the drupal solr configurations into solr:

  • cd /usr/share/drupal7/modules/search_api_solr/solr-conf/3.x/
    • cp *.xml protwords.txt stopwords.txt synonyms.txt solrcore.properties /usr/share/solr/conf/

Start solr:

  • /etc/init.d/tomcat7 start

Install the drupal modules for talking to solr.

Drupal7

  • cd /usr/share/drupal7/modules
    • wget https://ftp.drupal.org/files/projects/entity-7.x-1.6.tar.gz
    • tar -xzf entity-7.x-1.6.tar.gz
    • wget https://ftp.drupal.org/files/projects/search_api-7.x-1.17.tar.gz
    • tar -xzf search_api-7.x-1.17.tar.gz
    • wget https://ftp.drupal.org/files/projects/search_api_db-7.x-1.5.tar.gz
    • tar -xzf search_api_db-7.x-1.5.tar.gz
    • wget https://ftp.drupal.org/files/projects/search_api_solr-7.x-1.10.tar.gz
    • tar -xzf search_api_solr-7.x-1.10.tar.gz

Log into the web interface, and enable the 'Entity API', 'Database search', 'Search API', and 'Solr search' modules.

  • click on 'Configure' next to the 'Search API'.
    • Click on 'Add server'.
      • Pick a name and a description for your SOLR search provider.
      • Change the 'Service class' to 'Solr service'. the dropdowns below this section of the page will appear.
      • Change the 'Solr port' to 8080, for tomcat.
      • Accept the rest of the defaults, by clicking on 'Create server'.
  • click on 'Configure' next to the 'Search API'.
    • Click on 'Add index'.
      • Pick a name and a description for your index.
      • Select 'Node' in the Item type dropdown.
      • Select the server created in the last step.
      • select the check box next to 'Index items immediately'.
      • Accept the rest of the defaults, by clicking on 'Create index'. This will open a new page.
      • Go to the bottom of the next page, and select 'Add Related Fields'.
        • add the fields for author, and for the main body text.
      • select 'Content Type', 'Title', 'Date Created', 'Date Changed', 'Author', 'Author » User roles', and 'The main body text » Text'. make sure the Title has a higher priority than the Main Body Text.
      • Save Changes. This will open a 'filters' tab.
      • Select 'Exclude unpublished nodes', and hit 'Save Configuration'.

Drupal8

  • sudo apt-get install php5-gd php5-mysql ca-certificates apache2-mpm-prefork libapache2-mod-php5 mariadb-server
  • Make unstable available as a debian repository, then:
    • sudo apt-get install composer php5.6-curl php-curl php5-curl
    • NOTE: composer is required for civicrm-drupal.
  • sudo a2enmod rewrite

Tip

From git:

  • cd /var/www/html
    • sudo git clone https://github.com/drupal/drupal.git drupal8

Common

  • sudo mkdir /var/www/html/drupal8/sites/default/files
  • sudo chown www-data.www-data /var/www/html/drupal8/sites/default/files
  • cd /var/www/html/drupal8/sites/default
    • add the following configuration changes in the appropriate places inside default.settings.php:
      $settings['reverse_proxy'] = TRUE;
      $settings['reverse_proxy_addresses'] = array('172.16.0.1', '10.0.2.51');
      
    • sudo cp default.settings.php settings.php
  • sudo chown www-data.www-data /var/www/html/drupal8/sites/default/settings.php
  • sudo chown www-data.www-data /var/www/html/drupal8/sites/default

Enable clean URLs

Nick-old

  • Add the following right before the closing tag of /etc/apache2/sites-available/000-default.conf
    <directory /var/www/html>
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ drupal8/index.php [L]
    </directory>
    

Tip

  • Add the following right before the closing tag of /etc/apache2/sites-available/000-default.conf
    <directory /var/www/html>
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ drupal8/?q=$1 [L,QSA]
    </directory>
    

common

  • Restart apache.
    • sudo service apache2 restart

Database Setup

  • mysql -u root -p
    • create database drupal8;
    • create user drupal;
    • GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, TRIGGER, CREATE TEMPORARY TABLES ON drupal8.* TO 'drupal'@'localhost' IDENTIFIED BY 'password';
      • Note that TRIGGER is required for CiviCRM, not drupal.
    • quit

Composer

  • cd /var/www/html/drupal8
    • apt install unzip phpunit php-mbstring
    • sudo composer install

Web Interface

Go to the URL of your Drupal8 server.

  • Yes, you have to continue anyway, due to drupal8 not detecting that clean URLs are available.
  • No, do not bother checking for updates. We are going to handle this manually.

CiviCRM

  • sudo mkdir /var/www/html/drupal8/libraries

Nick

  • cd /var/www/html/drupal8/libraries
    • wget http://dist.civicrm.org/by-date/latest/master/civicrm-4.7.beta1-drupal-20151103.tar.gz
    • tar -xzf civicrm-4.7.beta1-drupal-20151103.tar.gz
    • rm -rf /var/www/html/drupal8/libraries/civicrm/drupal

Tip

From git:

  • cd /var/www/html/drupal8/libraries
    • sudo git clone https://github.com/civicrm/civicrm-core civicrm
  • cd /var/www/html/drupal8/libraries/civicrm
    • sudo composer install
    • sudo git clone https://github.com/civicrm/civicrm-packages.git packages

CiviCRM-Drupal

From git:

  • cd /var/www/html/drupal8/modules/
    • sudo git clone -b 8.x-master http://github.com/civicrm/civicrm-drupal.git civicrm

Running the Code Generator

  • cd /var/www/html/drupal8/libraries/civicrm/
    • sudo ln -s ../../modules/civicrm/ drupal

Either:

  • cd /var/www/html/drupal8/libraries/civicrm/xml/
    • sudo php -d mysql.default_host="$PHP_MYSQL_HOSTPORT" -d mysql.default_user=$DBUSER -d mysql.default_password=$DBPASS GenCode.php schema/Schema.xml '' "drupal"

Or:

Installing packages with Bower

  • apt-get install npm
  • cd /var/www/html/drupal8/libraries/civicrm/
    • npm install bower
    • sudo nodejs ./node_modules/bower/bin/bower --allow-root install

Web Interface

  • under 'Extend', select the 'CiviCRM Core' extension, and scroll to the bottom of the page to 'Install'.
  • under 'Extend', select the 'CiviCRM Views' extension, and scroll to the bottom of the page to 'Install'.

Themes

Danland

Not yet ported. They say it will be, but... Email sent to developer, no response.

Civi Bartik

Reported working at one time.

  • cd /var/www/html/drupal8/themes/
    • git clone -b 8.x-1.x git://git.drupal.org/project/civi_bartik.git

Pre-Work Update Procedure

  • cd /var/www/html/drupal8/
    • sudo git remote update
    • sudo git pull
  • cd /var/www/html/drupal8/modules/civicrm/
    • sudo git remote update
    • sudo git pull
  • cd /var/www/html/drupal8/libraries/civicrm
    • sudo git remote update
    • sudo git pull
  • cd /var/www/html/drupal8/libraries/civicrm/packages/
    • sudo git remote update
    • sudo git pull

Reset Procedure

  • mysql -u root -p
    • drop database drupal8;
    • create database drupal8;
    • GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, TRIGGER, CREATE TEMPORARY TABLES ON drupal8.* TO 'drupal'@'localhost' IDENTIFIED BY 'password';
    • quit
  • cd /var/www/html/drupal8/sites/default/
    • sudo cp default.settings.php settings.php

FIXME

  • dpkg-reconfigure tzdata
    • chose ETC/UTC
  • mysql -u root -p
    • grant ALTER ROUTINE, CREATE ROUTINE, EXECUTE on *.* to 'drupal'@'localhost';

if you get noise about sql_trigger, clear the civicrm cache.

Last modified 15 months ago Last modified on 06/28/16 20:36:56