1. Create a database, database user (with all permissions) and a database user password. Most hosting environments let you do this from a mySQL link in the Control Panel. You can administer the database using phpMyAdmin, also accessible from the Control Panel.

  2. Unpack the Drupal 8.x distribution in a directory and open that directory in a Web page.

  3. Follow the installation instructions and eventually you will be shown the site home page.

  4. Be sure that your webpage hosting environment for PHP is at least PHP 7.0. The newer the better. Be sure that your command line PHP version is also at least 7.0. 

  5. Install composer by putting this php file into the Drupal directory https://getcomposer.org/installer. Run the installer:  

    php ./installer

  6. Link composer.phar to composer (for convenience):

    ln -s composer.phar composer

  7. Install drush using composer:

    php composer require drush/drush

    ln -s vendor/drush/drush/drush ./drush

  8. Although Drupal has a GUI interface for managing modules, in Drupal 8 it is better to install them using composer because it correctly makes the two composer.json and composer.lock files. Also, they are placed in the modules/contrib directory rather than in modules. Unless you are doing Drupal development, use the --no-dev option in the following:

    php composer update --no-dev

    Confusingly, it asks you

    Discard changes [y,n,v,d,?]?

       y - discard changes and apply the uninstall

       n - abort the uninstall and let you manually clean things up

       v - view modified files

       d - view local modifications (diff)

       ? - print help

    and you want to answer yes. Answer yes a second time to actually update the symfony files inside the Drupal distribution

  9. You should install additional modules using composer:
    php composer require drupal/module_name

  10. You can enable a module from the command line using drush:
    drush en module_name -y

  11. At this point, it is a good time to check that your site is still working. Check for errors:

    ./drush watchdog-show

    or do this from the GUI Reports/Recent log messages. Using drush can help you to find errors if your GUI breaks with the infamous "The website encountered an unexpected error. Please try again later." message.

  12. Update your database using the update.php web page, or using drush

    ./drush updatedb

  13. Now install your initial module set using composer. I recommend stopping occasionally to check that your site is still working. Installing admin_menu totally trashed my site. (Use admin_toolbar instead.). If you are updating your site from a previous version of Drupal (6 or 7), install all of the modules that were activated in your old site, and make a list of those unavailable in Drupal 8. Using composer to install modules also installs their required libraries and enters the modules into the composer.json and composer.lock files. Installing from the Extend menu does not do these things.

    php composer require drupal/your_module_name

  14. While you are doing the above, use the GUI Extend web page to find and activate each newly-installed modules to be sure nothing is going wrong.

  15. Clear your caches after any big change to see the result

    ./drush cr

    and now is a good time to back up your database using phpMyAdmin. Also zip up your Drupal directory, for example:

    zip -r d8-10-22-2018.zip d8

  16. Every time there is an update for the Drupal core, you need to replace the core and vendor directories and all of the .php files in the main directory. You then must run steps 7 and 8 and 10 again.

  17. You should now run a status report. You will probably find the following, but you should NOT fix this until your site is moved to its final location.

    TRUSTED HOST SETTINGS

    Not enabled

    The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is highly recommended that you configure this. See Protecting against HTTP HOST Header attacks for more information.

  18. If you are upgrading from a previous Drupal version, now is the time to run your update. Be sure to install and enable all of the update modules first.

    https://www.drupal.org/docs/8/upgrade/drupal-8-migrate-modules

    especially Migrate Drupal UI unless you wish to upgrade using drush. It is a good idea to copy all of your public files to the new site (if you want them) before the upgrade.


What if things go wrong?

Here is an example of what can go wrong with Composer:

[RuntimeException]
  Failed to execute git clone --no-checkout 'https://git.drupal.org/project/coder.git' 
'/home2/orcmaorg/public_html
  /vendor/drupal/coder' --dissociate --reference 
'/home2/orcmaorg/.composer/cache/vcs/https---git.drupal.org-projec
  t-coder.git/' && cd '/home2/orcmaorg/public_html/vendor/drupal/coder' 
&& git remote add composer 'https://git.drupal.org/project/coder.git' 
&& git fetch composer
  Cloning into '/home2/orcmaorg/public_html/vendor/drupal/coder'...
  fatal: unable to create thread: Resource temporarily unavailable
  fatal: cannot repack to clean up

Note that the URL in red does not exist. You need to search the bugs in the coder project to find https://www.drupal.org/project/coder/issues/2919773#comment-12846434
which says the code is at https://github.com/klausi/coder

There are two files that Composer creates and updates (an important reason to do things using Composer and not the GUI).

  • composer.json lists all the system modules in your Drupal, and which versions of each module is needed. I ran into problems with entity_update, which is required by drush (I think):
          "drupal/entity_update": "^1.1"
    but it needed to be
           "drupal/entity_update": "^1.2@RC"
    so I edited this file.
  • composer.lock gives the name of each system module, and all of its metadata, including where to get the module. It is here that you have to fix the above URL:
            {
                "name": "drupal/entity_update",
                "version": "1.2",
                "source": {
                    "type": "git",
                    "url": "https://git.drupal.org/project/entity_update",
                    "reference": "8.x-1.2-rc7"
                },
                "dist": {
                    "type": "zip",
                    "url": "https://ftp.drupal.org/files/projects/entity_update-8.x-1.2-rc7.zip",
                    "reference": "8.x-1.2-rc7",
                    "shasum": "1da5f2de7c6adcda9eac8140b5406e588910d50b"
                },
                "require": {
                    "drupal/core": "~8.0"
                },
                "type": "drupal-module",
                "extra": {
                    "branch-alias": {
                        "dev-1.x": "1.x-dev",
                        "dev-master": "1.2.x-dev"
                    },
                    "drupal": {
                        "version": "8.x-1.2-rc7",
                        "datestamp": "1515696784",
                        "security-coverage": {
                            "status": "not-covered",
                            "message": "Project has not opted into security advisory coverage!"
                        }
                    }
                },
                "notification-url": "https://packages.drupal.org/8/downloads",
                "license": [
                    "GPL"
                ],
                "authors": [
                    {
                        "name": "Nuwantha",
                        "homepage": "https://www.drupal8.ovh",
                        "role": "Admin"
                    }
                ],
                "description": "Update Drupal 8 Entity schema.",
                "homepage": "https://www.drupal.org/project/entity_update",
                "support": {
                    "source": "
    https://github.com/klausi/coder",
                    "issues": "https://www.drupal.org/project/issues/entity_update"
                }
            },

But making these changes still gave the same error message!

Composer makes a .composer directory above your Drupal main directory. Inside of this is a cache directory. It too must be deleted. Then everything will work.

Drupal 8 should not be this difficult!!!!


Finding things inside Drupal

I grabbed these tips on how to find things that are referred to in your Drupal installation, but are missing:

Do the following:

grep -rnw '/path/to/somewhere/' -e "pattern"

  • -r or -R is recursive,

  • -n is line number, and

  • -w stands match the whole word.

  • -l (lower-case L) can be added to just give the file name of matching files.

  • Along with these, --exclude or --include parameter could be used for efficient searching. Something like below:

grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"

This will only search through the files which have .c or .h extensions. Similarly a sample use of --exclude:

grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"

Above will exclude searching all the files ending with .o extension. Just like exclude file it's possible to exclude/include directories through --exclude-dir and --include-dir parameter; for example, the following shows how to integrate --exclude-dir:

grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"

--------

grep -Ril "text-to-find-here" /

Add new comment

Comment

  • No HTML tags allowed.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions. Image CAPTCHA
Enter the characters shown in the image.