install_drupal.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. The user's guide makes use the environmental variable ``$DRUPAL_HOME`` to track where Drupal will be installed. The default location for Drupal is ``/var/www/html``, but set this variable to wherever you would like your Drupal site installed. For example, older Ubuntu setups use ``/var/www`` instead. To use ``/var/www/html``, execute the below command, or, replace the path with your desired location. **YOU MUST SET THIS VARIABLE FOR THE BELOW GUIDE TO SUCCEED**.
  22. .. code-block:: bash
  23. DRUPAL_HOME=/var/www/html
  24. 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:
  25. .. code-block:: bash
  26. sudo chown -R [user] $DRUPAL_HOME
  27. Substitute [user] for the name of the user that will own the web files.
  28. .. note::
  29. 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.
  30. 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.59. The software can be downloaded manually from the Drupal website through a web browser or we can use the ``wget`` command to retrieve it:
  31. .. code-block:: bash
  32. cd $DRUPAL_HOME
  33. wget http://ftp.drupal.org/files/projects/drupal-7.59.tar.gz
  34. Next, we want to install Drupal. We will use the tar command to uncompress the software:
  35. .. code-block:: bash
  36. tar -zxvf drupal-7.59.tar.gz
  37. Notice that we now have a drupal-7.59 directory with all of the Drupal files. We want the Drupal files to be in our document root, not in a 'drupal-7.59' subdirectory. So, we'll move the contents of the directory up one level:
  38. .. code-block:: bash
  39. mv drupal-7.59/* ./
  40. mv drupal-7.59/.htaccess ./
  41. 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:
  42. .. code-block:: bash
  43. mv index.html index.html.orig
  44. .. note::
  45. 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:
  46. .. code-block:: bash
  47. ls -l .htaccess
  48. Configuration File
  49. ------------------
  50. 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.
  51. First navigate to the location where the configuration file should go:
  52. .. code-block:: bash
  53. cd $DRUPAL_HOME/sites/default/
  54. Next, copy the example configuration that already exists in the directory to be our actual configuration file by renaming it to ``settings.php``.
  55. .. code-block:: bash
  56. cp default.settings.php settings.php
  57. 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**.
  58. .. code-block:: bash
  59. gedit settings.php
  60. Find the following line
  61. .. code-block:: php
  62. $databases = array();
  63. and then insert the following array just after the above line:
  64. .. code-block:: php
  65. $databases['default']['default'] = array(
  66. 'driver' => 'pgsql',
  67. 'database' => 'drupal',
  68. 'username' => 'drupal',
  69. 'password' => '********',
  70. 'host' => 'localhost',
  71. 'prefix' => '',
  72. );
  73. Replace the text '********' with your database password for the user 'drupal' created previously. Save the configuration file and close the editor.
  74. Files Directory Creation
  75. --------------------------
  76. 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.
  77. .. code-block:: bash
  78. mkdir -p $DRUPAL_HOME/sites/default/files
  79. sudo chgrp [group] $DRUPAL_HOME/sites/default/files
  80. sudo chmod g+rw $DRUPAL_HOME/sites/default/files
  81. 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.
  82. Web-based Steps
  83. ---------------
  84. Navigate to the installation page of our new web site http://localhost/install.php
  85. .. image:: install_drupal.install1.png
  86. 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**:
  87. .. image:: install_drupal.install2.png
  88. Next, you will see a progress bar as Drupal is installed.
  89. .. image:: install_drupal.install3.png
  90. Once it completes, a configuration page with some final settings will be visible.
  91. .. image:: install_drupal.install4.png
  92. 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:
  93. - Site Information
  94. - Site Name: Tripal 3.x
  95. - Site email: Your email address
  96. - Site Maintenance Account
  97. - Username: administrator (all lower-case)
  98. - Email: Your email address
  99. - Password: ********
  100. - Server Settings
  101. - Default country: (wherever the site is located)
  102. - Default time zone: (your time zone)
  103. - Update Notifications (both boxes checked)
  104. 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:
  105. .. image:: install_drupal.install5.png