install_drupal.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. Drupal Installation
  2. ===================
  3. Database Setup
  4. --------------
  5. Drupal can use a MySQL or PostgreSQL database but Chado prefers PostgreSQL so that is what we will use for both Drupal and Chado. We need to create the Drupal database. The following command can be used to create a new database user and database.
  6. First, become the 'postgres' user:
  7. .. code-block:: bash
  8. sudo su - postgres
  9. Next, create the new 'drupal' user account. This account will not be a "superuser' nor allowed to create new roles, but should be allowed to create a database.
  10. .. code-block:: bash
  11. createuser -P drupal
  12. When requested, enter an appropriate password. Finally, create the new database:
  13. .. code-block:: bash
  14. createdb drupal -O drupal
  15. We no longer need to be the postgres user so exit
  16. .. code-block:: bash
  17. exit
  18. Software Installation
  19. ---------------------
  20. .. note::
  21. Remember you must set the ``$DRUPAL_HOME`` environment variable if you want to cut-and-paste the commands below. See :doc:`../drupal_home`
  22. Before we can install Drupal we must ensure that that we are allowed to add files into the root directory. Select a user account that will be the owner of all web files and change the owner of the ``$DRUPAL_HOME`` directory to that user:
  23. .. code-block:: bash
  24. sudo chown -R [user] $DRUPAL_HOME
  25. Substitute [user] for the name of the user that will own the web files.
  26. .. note::
  27. The apache web server runs as the user 'www-data'. For security reasons you should chose a user other than 'www-data' to be the owner of the Drupal root directory.
  28. Tripal 3.x requires version 7.x of Drupal. Drupal can be freely downloaded from the http://www.drupal.org website. At the writing of this Tutorial the most recent version of Drupal 7 is version 7.69. The software can be downloaded manually from the Drupal website through a web browser or we can use the ``wget`` command to retrieve it:
  29. .. code-block:: bash
  30. cd $DRUPAL_HOME
  31. wget http://ftp.drupal.org/files/projects/drupal-7.69.tar.gz
  32. Next, we want to install Drupal. We will use the tar command to uncompress the software:
  33. .. code-block:: bash
  34. tar -zxvf drupal-7.69.tar.gz
  35. Notice that we now have a drupal-7.69 directory with all of the Drupal files. We want the Drupal files to be in our document root, not in a 'drupal-7.69' subdirectory. So, we'll move the contents of the directory up one level:
  36. .. code-block:: bash
  37. mv drupal-7.69/* ./
  38. mv drupal-7.69/.htaccess ./
  39. If an index.html file is present (as is the case with Ubuntu installations) you can move it out of the way so that it does not interfere with Drupal by executing the following:
  40. .. code-block:: bash
  41. mv index.html index.html.orig
  42. .. note::
  43. It is extremely important the the hidden file ``.htaccess`` is also moved (note the second ``mv`` command above. Check to make sure this file is there:
  44. .. code-block:: bash
  45. ls -l .htaccess
  46. Configuration File
  47. ------------------
  48. Next, we need to tell Drupal how to connect to our database. To do this we have to setup a configuration file. Drupal comes with an example configuration file which we can borrow.
  49. First navigate to the location where the configuration file should go:
  50. .. code-block:: bash
  51. cd $DRUPAL_HOME/sites/default/
  52. Next, copy the example configuration that already exists in the directory to be our actual configuration file by renaming it to ``settings.php``.
  53. .. code-block:: bash
  54. cp default.settings.php settings.php
  55. Now, we need to edit the configuration file to tell Drupal how to connect to our database server. To do this we'll use an easy to use text editor **gedit**.
  56. .. code-block:: bash
  57. gedit settings.php
  58. Find the following line
  59. .. code-block:: php
  60. $databases = array();
  61. and then insert the following array just after the above line:
  62. .. code-block:: php
  63. $databases['default']['default'] = array(
  64. 'driver' => 'pgsql',
  65. 'database' => 'drupal',
  66. 'username' => 'drupal',
  67. 'password' => '********',
  68. 'host' => 'localhost',
  69. 'prefix' => '',
  70. );
  71. Replace the text '********' with your database password for the user 'drupal' created previously. Save the configuration file and close the editor.
  72. Files Directory Creation
  73. --------------------------
  74. Finally, we need to create the directory where Drupal will have write-access to add files. By default, Drupal expects to have write permission in the ``$DRUPAL_HOME/sites/default/files`` directory. Therefore, we will set group ownership of the directory to the group used by the Apache web server. This will be the user that Drupal uses to write files.
  75. .. code-block:: bash
  76. mkdir -p $DRUPAL_HOME/sites/default/files
  77. sudo chgrp [group] $DRUPAL_HOME/sites/default/files
  78. sudo chmod g+rw $DRUPAL_HOME/sites/default/files
  79. Substitute [group] for the name of the web server's group. In Ubuntu this is www-data in CentOS this is apache. The above commands creates the directory, sets the group ownership for group, and gives read/write permissions to the group on the directory.
  80. Web-based Steps
  81. ---------------
  82. Navigate to the installation page of our new web site http://localhost/install.php
  83. .. image:: install_drupal.install1.png
  84. Ensure that Standard is selected and click **Save and Continue**. You will next be asked to select the language you want to use. Choose **English**:
  85. .. image:: install_drupal.install2.png
  86. Next, you will see a progress bar as Drupal is installed.
  87. .. image:: install_drupal.install3.png
  88. Once it completes, a configuration page with some final settings will be visible.
  89. .. image:: install_drupal.install4.png
  90. Here you will provide details appropriate for your site, including your site name and administrative password. If you are experimenting with Tripal the following values can be used:
  91. - Site Information
  92. - Site Name: Tripal 3.x
  93. - Site email: Your email address
  94. - Site Maintenance Account
  95. - Username: administrator (all lower-case)
  96. - Email: Your email address
  97. - Password: ********
  98. - Server Settings
  99. - Default country: (wherever the site is located)
  100. - Default time zone: (your time zone)
  101. - Update Notifications (both boxes checked)
  102. Now, click the **Save and Continue** button. You will see a message about unable to send an email. This is safe to ignore for the tutorial, but for a production site you will need that your server can send emails to a service provider. Now, your site is enabled. Click the link Your new site:
  103. .. image:: install_drupal.install5.png