annotate core/INSTALL.txt @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1
Chris@0 2 CONTENTS OF THIS FILE
Chris@0 3 ---------------------
Chris@0 4
Chris@17 5 * Quickstart
Chris@0 6 * Requirements and notes
Chris@0 7 * Optional server requirements
Chris@0 8 * Installation
Chris@0 9 * Reinstall
Chris@0 10 * Building and customizing your site
Chris@0 11 * Multisite configuration
Chris@0 12 * Multilingual configuration
Chris@0 13
Chris@17 14 QUICKSTART
Chris@17 15 ----------------------
Chris@17 16
Chris@17 17 Prerequisites:
Chris@17 18 - PHP 5.5.9 (or greater) (https://php.net).
Chris@17 19
Chris@17 20 In the instructions below, replace the version x.y.z with the specific version
Chris@17 21 you wish to download. Example: 8.6.0.zip. You can find the latest stable version
Chris@17 22 at https://www.drupal.org/project/drupal.
Chris@17 23
Chris@17 24 Download and extract the Drupal package:
Chris@17 25 - curl -sS https://ftp.drupal.org/files/projects/drupal-x.y.z.zip --output drupal-x.y.z.zip
Chris@17 26 - unzip drupal-x.y.z.zip
Chris@17 27 - cd /path/to/drupal-x.y.z
Chris@17 28 - php core/scripts/drupal quick-start
Chris@17 29
Chris@17 30 Wait… installation can take a minute or two. A successful installation will
Chris@17 31 result in opening the new site in your browser.
Chris@17 32
Chris@17 33 Run the following command for a list of available options that you may need to
Chris@17 34 configure quick-start:
Chris@17 35 - php core/scripts/drupal quick-start --help
Chris@17 36
Chris@17 37 Follow the instructions in the REINSTALL section below to start over.
Chris@17 38
Chris@17 39 NOTE: This quick start solution uses PHP's built-in web server and is not
Chris@17 40 intended for production use. Read more about how to run Drupal in a production
Chris@17 41 environment below.
Chris@17 42
Chris@0 43 REQUIREMENTS AND NOTES
Chris@0 44 ----------------------
Chris@0 45
Chris@0 46 Drupal requires:
Chris@0 47
Chris@0 48 - A web server with PHP support, for example:
Chris@0 49 - Apache 2.0 (or greater) (http://httpd.apache.org/).
Chris@0 50 - Nginx 1.1 (or greater) (http://nginx.com/).
Chris@0 51 - PHP 5.5.9 (or greater) (http://php.net/). For better security support it is
Chris@0 52 recommended to update to at least 5.5.21 or 5.6.5.
Chris@0 53 - One of the following databases:
Chris@0 54 - MySQL 5.5.3 (or greater) (http://www.mysql.com/).
Chris@0 55 - MariaDB 5.5.20 (or greater) (https://mariadb.org/). MariaDB is a fully
Chris@0 56 compatible drop-in replacement for MySQL.
Chris@0 57 - Percona Server 5.5.8 (or greater) (http://www.percona.com/). Percona
Chris@0 58 Server is a backwards-compatible replacement for MySQL.
Chris@0 59 - PostgreSQL 9.1.2 (or greater) (http://www.postgresql.org/).
Chris@0 60 - SQLite 3.7.11 (or greater) (http://www.sqlite.org/).
Chris@0 61
Chris@0 62 For more detailed information about Drupal requirements, including a list of
Chris@0 63 PHP extensions and configurations that are required, see "System requirements"
Chris@0 64 (https://www.drupal.org/requirements) in the Drupal.org online documentation.
Chris@0 65
Chris@0 66 For detailed information on how to configure a test server environment using a
Chris@0 67 variety of operating systems and web servers, see "Local server setup"
Chris@0 68 (https://www.drupal.org/node/157602) in the Drupal.org online documentation.
Chris@0 69
Chris@0 70 Note that all directories mentioned in this document are always relative to the
Chris@0 71 directory of your Drupal installation, and commands are meant to be run from
Chris@0 72 this directory (except for the initial commands that create that directory).
Chris@0 73
Chris@0 74 OPTIONAL SERVER REQUIREMENTS
Chris@0 75 ----------------------------
Chris@0 76
Chris@0 77 - If you want to use Drupal's "Clean URLs" feature on an Apache web server, you
Chris@0 78 will need the mod_rewrite module and the ability to use local .htaccess
Chris@0 79 files. For Clean URLs support on IIS, see "Clean URLs with IIS"
Chris@0 80 (https://www.drupal.org/node/3854) in the Drupal.org online documentation.
Chris@0 81
Chris@0 82 - If you plan to use XML-based services such as RSS aggregation, you will need
Chris@0 83 PHP's XML extension. This extension is enabled by default on most PHP
Chris@0 84 installations.
Chris@0 85
Chris@0 86 - To serve gzip compressed CSS and JS files on an Apache web server, you will
Chris@0 87 need the mod_headers module and the ability to use local .htaccess files.
Chris@0 88
Chris@0 89 - Some Drupal functionality (e.g., checking whether Drupal and contributed
Chris@0 90 modules need updates, RSS aggregation, etc.) require that the web server be
Chris@0 91 able to go out to the web and download information. If you want to use this
Chris@0 92 functionality, you need to verify that your hosting provider or server
Chris@0 93 configuration allows the web server to initiate outbound connections. Most web
Chris@0 94 hosting setups allow this.
Chris@0 95
Chris@0 96 - PHP 5.5.21 provides features for improved security when used with MySQL. While
Chris@0 97 this is not required, it is highly encouraged to use PHP 5.5.21 or 5.6.5 and
Chris@0 98 above.
Chris@0 99
Chris@0 100 INSTALLATION
Chris@0 101 ------------
Chris@0 102
Chris@0 103 1. Download and extract Drupal.
Chris@0 104
Chris@0 105 You can obtain the latest Drupal release from https://www.drupal.org -- the
Chris@0 106 files are available in .tar.gz and .zip formats and can be extracted using
Chris@0 107 most compression tools.
Chris@0 108
Chris@0 109 To download and extract the files, on a typical Unix/Linux command line, use
Chris@0 110 the following commands (assuming you want version x.y.z of Drupal in .tar.gz
Chris@0 111 format):
Chris@0 112
Chris@0 113 wget https://www.drupal.org/files/projects/drupal-x.y.z.tar.gz
Chris@0 114 tar -zxvf drupal-x.y.z.tar.gz
Chris@0 115
Chris@0 116 This will create a new directory drupal-x.y.z/ containing all Drupal files
Chris@0 117 and directories. Then, to move the contents of that directory into a
Chris@0 118 directory within your web server's document root or your public HTML
Chris@0 119 directory, continue with this command:
Chris@0 120
Chris@0 121 mv drupal-x.y.z/* drupal-x.y.z/.htaccess drupal-x.y.z/.csslintrc drupal-x.y.z/.editorconfig drupal-x.y.z/.eslintignore drupal-x.y.z/.eslintrc.json drupal-x.y.z/.gitattributes /path/to/your/installation
Chris@0 122
Chris@0 123 You can also download the latest version of Drupal using Git on the command
Chris@0 124 line and set up a repository by following the instructions at
Chris@0 125 https://www.drupal.org/project/drupal/git-instructions for "Setting up
Chris@0 126 repository for the first time".
Chris@0 127
Chris@0 128 Once you have downloaded Drupal successfully, you may install Composer
Chris@0 129 globally using the instructions at
Chris@0 130 https://getcomposer.org/doc/00-intro.md#globally
Chris@0 131
Chris@0 132 With Composer installed, run the following command from the Drupal web root:
Chris@0 133
Chris@0 134 composer install
Chris@0 135
Chris@0 136 2. Create the Drupal database.
Chris@0 137
Chris@0 138 Because Drupal stores all site information in a database, the Drupal
Chris@0 139 installer will attempt to create this database for you. If you create the
Chris@0 140 database manually, you must grant Drupal certain database privileges (such as
Chris@0 141 the ability to create tables). For details, consult INSTALL.mysql.txt,
Chris@0 142 INSTALL.pgsql.txt, or INSTALL.sqlite.txt. You may also need to consult your
Chris@0 143 web hosting provider for instructions specific to your web host.
Chris@0 144
Chris@0 145 Take note of the username, password, database name, and hostname as you
Chris@0 146 create the database. You will enter this information during the install.
Chris@0 147
Chris@0 148 3. Run the install script.
Chris@0 149
Chris@0 150 To run the install script, point your browser to the base URL of your
Chris@0 151 website (e.g., http://www.example.com).
Chris@0 152
Chris@0 153 You will be guided through several screens to set up the database, add the
Chris@0 154 site maintenance account (the first user, also known as user/1), and provide
Chris@0 155 basic web site settings.
Chris@0 156
Chris@0 157 During installation, several files and directories need to be created, which
Chris@0 158 the install script will try to do automatically. However, on some hosting
Chris@0 159 environments, manual steps are required, and the install script will tell
Chris@0 160 you that it cannot proceed until you fix certain issues. This is normal and
Chris@0 161 does not indicate a problem with your server.
Chris@0 162
Chris@0 163 The most common steps you may need to perform are:
Chris@0 164
Chris@0 165 a. Missing files directory.
Chris@0 166
Chris@0 167 The install script will attempt to create a public file storage directory
Chris@0 168 in the default location at sites/default/files (the location of the files
Chris@0 169 directory may be changed after Drupal is installed).
Chris@0 170
Chris@0 171 If auto-creation fails, you can create the directory yourself. (If you are
Chris@0 172 creating a multisite installation, substitute the correct sites directory
Chris@0 173 for sites/default; see the Multisite Configuration section of this file,
Chris@0 174 below.) Sample commands from a Unix/Linux command line:
Chris@0 175
Chris@0 176 mkdir sites/default/files
Chris@0 177 chmod a+w sites/default/files
Chris@0 178
Chris@0 179 Alternatively, you can make the install script work by changing
Chris@0 180 permissions on the sites/default directory. The web server can then
Chris@0 181 create the files directory within it for you.
Chris@0 182
Chris@0 183 For example, on a Unix/Linux command line, you can you can grant everyone
Chris@0 184 (including the web server) permission to write to the sites/default
Chris@0 185 directory with this command:
Chris@0 186
Chris@0 187 chmod a+w sites/default
Chris@0 188
Chris@0 189 Then re-run install.php (e.g. by clicking "try again" at the bottom of
Chris@0 190 the Requirements problem page. Once the files directory is created, you
Chris@0 191 will need to grant everyone (including the web server) permission to
Chris@0 192 write to it with this command:
Chris@0 193
Chris@0 194 chmod a+w sites/default/files
Chris@0 195
Chris@0 196 Be sure to set the permissions for the default directory back after the
Chris@0 197 installation is finished! (Leave the files directory writeable.)
Chris@0 198 Sample command:
Chris@0 199
Chris@0 200 chmod go-w sites/default
Chris@0 201
Chris@0 202 b. Missing settings file.
Chris@0 203
Chris@0 204 Drupal will try to automatically create a settings.php configuration file,
Chris@0 205 which is normally in the directory sites/default (to avoid problems when
Chris@0 206 upgrading, Drupal is not packaged with this file). If auto-creation fails,
Chris@0 207 you will need to create this file yourself, using the file
Chris@0 208 sites/default/default.settings.php as a template.
Chris@0 209
Chris@0 210 For example, on a Unix/Linux command line, you can make a copy of the
Chris@0 211 default.settings.php file with the command:
Chris@0 212
Chris@0 213 cp sites/default/default.settings.php sites/default/settings.php
Chris@0 214
Chris@0 215 Next, grant write privileges to the file to everyone (including the web
Chris@0 216 server) with the command:
Chris@0 217
Chris@0 218 chmod a+w sites/default/settings.php
Chris@0 219
Chris@0 220 Be sure to set the permissions back after the installation is finished!
Chris@0 221 Sample command:
Chris@0 222
Chris@0 223 chmod go-w sites/default/settings.php
Chris@0 224
Chris@0 225 c. Write permissions after install.
Chris@0 226
Chris@0 227 The install script will attempt to write-protect the settings.php file and
Chris@0 228 the sites/default directory after saving your configuration. If this
Chris@0 229 fails, you will be notified, and you can do it manually. Sample commands
Chris@0 230 from a Unix/Linux command line:
Chris@0 231
Chris@0 232 chmod go-w sites/default/settings.php
Chris@0 233 chmod go-w sites/default
Chris@0 234
Chris@0 235 4. Verify that the site is working.
Chris@0 236
Chris@0 237 When the install script finishes, you will be logged in with the site
Chris@0 238 maintenance account on a "Welcome" page. If the default Drupal theme is not
Chris@0 239 displaying properly and links on the page result in "Page Not Found" errors,
Chris@0 240 you may be experiencing problems with clean URLs. Visit
Chris@18 241 https://www.drupal.org/docs/8/clean-urls-in-drupal-8 to troubleshoot.
Chris@0 242
Chris@0 243 5. Change file system storage settings (optional).
Chris@0 244
Chris@0 245 The files directory created in step 3 is the default file system path used to
Chris@0 246 store all uploaded files, as well as some temporary files created by
Chris@0 247 Drupal. After installation, you can modify the file system path to store
Chris@0 248 uploaded files in a different location.
Chris@0 249
Chris@0 250 It is not necessary to modify this path, but you may wish to change it if:
Chris@0 251
Chris@0 252 - Your site runs multiple Drupal installations from a single codebase (modify
Chris@0 253 the file system path of each installation to a different directory so that
Chris@0 254 uploads do not overlap between installations).
Chris@0 255
Chris@0 256 - Your site runs on a number of web servers behind a load balancer or reverse
Chris@0 257 proxy (modify the file system path on each server to point to a shared file
Chris@0 258 repository).
Chris@0 259
Chris@0 260 - You want to restrict access to uploaded files.
Chris@0 261
Chris@0 262 To modify the file system path:
Chris@0 263
Chris@0 264 a. Ensure that the new location for the path exists and is writable by the
Chris@0 265 web server. For example, to create a new directory named uploads and grant
Chris@0 266 write permissions, use the following commands on a Unix/Linux command
Chris@0 267 line:
Chris@0 268
Chris@0 269 mkdir uploads
Chris@0 270 chmod a+w uploads
Chris@0 271
Chris@0 272 b. Open your settings.php in a plain-text editor, and uncomment (remove the #
Chris@0 273 at the start of line) this line:
Chris@0 274
Chris@0 275 # $settings['file_public_path'] = 'sites/default/files';
Chris@0 276
Chris@0 277 Enter the desired path and save the file.
Chris@0 278
Chris@0 279 If you want to use private file storage, you need to uncomment (remove
Chris@0 280 the # at the start of line) the following line in settings.php:
Chris@0 281
Chris@0 282 # $settings['file_private_path'] = '';
Chris@0 283
Chris@0 284 Enter the path for private files and save the file.
Chris@0 285
Chris@0 286 Changing the file system path after files have been uploaded may cause
Chris@0 287 unexpected problems on an existing site. If you modify the file system path
Chris@0 288 on an existing site, remember to copy all files from the original location
Chris@0 289 to the new location.
Chris@0 290
Chris@0 291 6. Revoke documentation file permissions (optional).
Chris@0 292
Chris@0 293 Some administrators suggest making the documentation files, especially
Chris@0 294 CHANGELOG.txt, non-readable so that the exact version of Drupal you are
Chris@0 295 running is slightly more difficult to determine. If you wish to implement
Chris@0 296 this optional security measure, from a Unix/Linux command line you can use
Chris@0 297 the following command:
Chris@0 298
Chris@16 299 chmod a-r core/CHANGELOG.txt
Chris@0 300
Chris@0 301 Note that the example only affects CHANGELOG.txt. To completely hide all
Chris@0 302 documentation files from public view, repeat this command for each of the
Chris@0 303 Drupal documentation files in the installation directory, substituting the
Chris@0 304 name of each file for CHANGELOG.txt in the example.
Chris@0 305
Chris@0 306 For more information on setting file permissions, see "Modifying Linux,
Chris@0 307 Unix, and Mac file permissions" (https://www.drupal.org/node/202483) or
Chris@0 308 "Modifying Windows file permissions" (https://www.drupal.org/node/202491) in
Chris@0 309 the Drupal.org online documentation.
Chris@0 310
Chris@0 311 7. Set up independent "cron" maintenance jobs.
Chris@0 312
Chris@0 313 Many Drupal modules have tasks that must be run periodically, including the
Chris@0 314 Search module (building and updating the index used for keyword searching),
Chris@0 315 the Aggregator module (retrieving feeds from other sites), and the System
Chris@0 316 module (performing routine maintenance and pruning of database tables). These
Chris@0 317 tasks are known as "cron maintenance tasks", named after the Unix/Linux
Chris@0 318 "cron" utility.
Chris@0 319
Chris@0 320 When you install Drupal, its built-in cron feature is enabled, which
Chris@0 321 automatically runs the cron tasks periodically, triggered by people visiting
Chris@0 322 pages of your site. You can configure the built-in cron feature by navigating
Chris@0 323 to Administration > Configuration > System > Cron.
Chris@0 324
Chris@0 325 It is also possible to run the cron tasks independent of site visits; this is
Chris@0 326 recommended for most sites. To do this, you will need to set up an automated
Chris@0 327 process to visit the page /cron on your site, which executes the cron
Chris@0 328 tasks.
Chris@0 329
Chris@0 330 The URL of the cron page requires a "cron key" to protect against
Chris@0 331 unauthorized access. Your site's cron key is automatically generated during
Chris@0 332 installation and is specific to your site. The full URL of the page, with the
Chris@0 333 cron key, is available in the "Cron maintenance tasks" section of the Status
Chris@0 334 report page at Administration > Reports > Status report.
Chris@0 335
Chris@0 336 As an example for how to set up this automated process, you can use the
Chris@0 337 crontab utility on Unix/Linux systems. The following crontab line uses the
Chris@0 338 wget command to visit the cron page, and runs each hour, on the hour:
Chris@0 339
Chris@0 340 0 * * * * wget -O - -q -t 1 http://example.com/cron/YOURKEY
Chris@0 341
Chris@0 342 Replace the text "http://example.com/cron/YOURKEY" in the example with the
Chris@0 343 full URL displayed under "Cron maintenance tasks" on the "Status report"
Chris@0 344 page.
Chris@0 345
Chris@0 346 More information about cron maintenance tasks is available at
Chris@0 347 https://www.drupal.org/cron, and sample cron shell scripts can be found in
Chris@0 348 the core/scripts/ directory. (Note that these scripts must be customized like
Chris@0 349 the above example, to add your site-specific cron key and domain name.)
Chris@0 350
Chris@0 351 REINSTALL
Chris@0 352 ------------
Chris@0 353
Chris@0 354 Drupal can be reinstalled without downloading and extracting the Drupal release.
Chris@0 355
Chris@0 356 1. Drop all the tables in your database.
Chris@0 357
Chris@0 358 2. Remove everything in sites/default/files.
Chris@0 359
Chris@0 360 3. Remove sites/default/settings.php.
Chris@0 361
Chris@0 362 4. Follow the Installation Instructions above starting from Step 3 (Run the
Chris@0 363 install script).
Chris@0 364
Chris@0 365 BUILDING AND CUSTOMIZING YOUR SITE
Chris@0 366 ----------------------------------
Chris@0 367
Chris@0 368 A new installation of Drupal defaults to a very basic configuration. To extend
Chris@0 369 your site, you use "modules" and "themes". A module is a plugin that adds
Chris@0 370 functionality to Drupal, while a theme changes the look of your site. The core
Chris@0 371 of Drupal provides several optional modules and themes, and you can download
Chris@0 372 more at https://www.drupal.org/project/project_module and
Chris@0 373 https://www.drupal.org/project/project_theme
Chris@0 374
Chris@0 375 Do not mix downloaded or custom modules and themes with Drupal's core modules
Chris@0 376 and themes. Drupal's modules and themes are located in the /core/modules and
Chris@0 377 /core/themes directories, while the modules and themes you add to Drupal are
Chris@0 378 normally placed in the /modules and /themes directories. If you run a multisite
Chris@0 379 installation, you can also place modules and themes in the site-specific
Chris@0 380 directories -- see the Multisite Configuration section, below.
Chris@0 381
Chris@0 382 Never edit Drupal's core modules and themes; instead, use the hooks available in
Chris@0 383 the Drupal API. To modify the behavior of Drupal, develop a module as described
Chris@0 384 at https://www.drupal.org/developing/modules. To modify the look of Drupal,
Chris@0 385 create a subtheme as described at https://www.drupal.org/node/2165673, or a
Chris@0 386 completely new theme as described at https://www.drupal.org/docs/8/theming
Chris@0 387
Chris@0 388 MULTISITE CONFIGURATION
Chris@0 389 -----------------------
Chris@0 390
Chris@0 391 A single Drupal installation can host several Drupal-powered sites, each with
Chris@0 392 its own individual configuration.
Chris@0 393
Chris@0 394 For this to work you need the file sites/sites.php to exist. Make a copy of
Chris@0 395 the example.sites.php file:
Chris@0 396
Chris@0 397 $ cp sites/example.sites.php sites/sites.php
Chris@0 398
Chris@0 399 Additional site configurations are created in subdirectories within the 'sites'
Chris@0 400 directory. Each subdirectory must have a 'settings.php' file, which specifies
Chris@0 401 the configuration settings. The easiest way to create additional sites is to
Chris@0 402 copy file 'default.settings.php' from the 'sites/default' directory into the
Chris@0 403 new site directory with file name 'settings.php' and modify as appropriate.
Chris@0 404 The new directory name is constructed from the site's URL. The configuration
Chris@0 405 for www.example.com could be in 'sites/example.com/settings.php' (note that
Chris@0 406 'www.' should be omitted if users can access your site at http://example.com/).
Chris@0 407
Chris@18 408 $ cp sites/default/default.settings.php sites/example.com/settings.php
Chris@0 409
Chris@0 410 Sites do not have to have a different domain. You can also use subdomains and
Chris@0 411 subdirectories for Drupal sites. For example, example.com, sub.example.com, and
Chris@0 412 sub.example.com/site3 can all be defined as independent Drupal sites. The setup
Chris@0 413 for a configuration such as this would look like the following:
Chris@0 414
Chris@0 415 sites/default/settings.php
Chris@0 416 sites/example.com/settings.php
Chris@0 417 sites/sub.example.com/settings.php
Chris@0 418 sites/sub.example.com.site3/settings.php
Chris@0 419
Chris@0 420 When searching for a site configuration (for example www.sub.example.com/site3),
Chris@0 421 Drupal will search for configuration files in the following order, using the
Chris@0 422 first configuration it finds:
Chris@0 423
Chris@0 424 sites/www.sub.example.com.site3/settings.php
Chris@0 425 sites/sub.example.com.site3/settings.php
Chris@0 426 sites/example.com.site3/settings.php
Chris@0 427 sites/www.sub.example.com/settings.php
Chris@0 428 sites/sub.example.com/settings.php
Chris@0 429 sites/example.com/settings.php
Chris@0 430 sites/default/settings.php
Chris@0 431
Chris@0 432 If you are installing on a non-standard port, the port number is treated as the
Chris@0 433 deepest subdomain. For example: http://www.example.com:8080/ could be loaded
Chris@0 434 from sites/8080.www.example.com/. The port number will be removed according to
Chris@0 435 the pattern above if no port-specific configuration is found, just like a real
Chris@0 436 subdomain.
Chris@0 437
Chris@0 438 Each site configuration can have its own site-specific modules and themes in
Chris@0 439 addition to those installed in the standard 'modules' and 'themes' directories.
Chris@0 440 To use site-specific modules or themes, simply create a 'modules' or 'themes'
Chris@0 441 directory within the site configuration directory. For example, if
Chris@0 442 sub.example.com has a custom theme and a custom module that should not be
Chris@0 443 accessible to other sites, the setup would look like this:
Chris@0 444
Chris@0 445 sites/sub.example.com/
Chris@0 446 settings.php
Chris@0 447 themes/custom_theme
Chris@0 448 modules/custom_module
Chris@0 449
Chris@0 450 For more information about multiple virtual hosts or the configuration
Chris@18 451 settings, consult https://www.drupal.org/docs/8/multisite
Chris@0 452
Chris@0 453 For more information on configuring Drupal's file system path in a multisite
Chris@0 454 configuration, see step 6 above.
Chris@0 455
Chris@0 456 MULTILINGUAL CONFIGURATION
Chris@0 457 --------------------------
Chris@0 458
Chris@0 459 By default, Drupal is installed in one language, and further languages may be
Chris@0 460 installed later.
Chris@0 461
Chris@0 462 For detailed instructions, visit
Chris@18 463 https://www.drupal.org/docs/8/multilingual