centos_7.rst 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. Server Setup (CentOS 7)
  2. =======================
  3. .. note::
  4. Tripal can be installed on multiple UNIX/Linux based systems. These instructions are for just CentOS 7. However, this guide provides
  5. instructions for a several systems. Please choose the one that best suits your needs. If you install on a different platform please consider sharing your notes and experience to add to this guide!
  6. The following sections provide step-by-step instructions for installation of Tripal on a CentOS 7 server. They provide details for setup of the server, including installation of the Apache web server and the PostgreSQL database server; installation of Drupal; installation of Drush, the command-line interface for Drupal; prerequisites for Tripal; and installation of Tripal within Drupal.
  7. CentOS 7 Installation
  8. ---------------------
  9. Please follow the online instructions for download and installation of CentOS 7. The CentOS installation must have the following:
  10. - A user account with administrative access (i.e. sudo privilege).
  11. - A graphical desktop.
  12. - An installed web browser.
  13. - The "Development Tools" should be installed. To install the development tools issue this command:
  14. .. code-block:: bash
  15. sudo yum groupinstall "Development Tools"
  16. - A graphical text editor such as 'gedit'. To Install gedit issue this command:
  17. .. code-block:: bash
  18. sudo yum install gedit
  19. - The 'wget' utilty for retrieving files from remote web services. To install wget issue this command:
  20. .. code-block:: bash
  21. sudo yum install wget
  22. The tutorial below will provide the necessary steps to install the server components needed. If you are using this tutorial to test Tripal you can use a virtual machine such as the `Oracle VirtualBox <https://www.virtualbox.org/>`_ or `VMWare <http://www.vmware.com/>`_. The virtual machine allows you to install Ubuntu as a "guest" operating system within your existing "host" operating system (e.g. Windows).
  23. Apache Installation
  24. -------------------
  25. Apache is the web server software. CentOS simplifies the installation of Apache using the 'yum' utility. To do so, simply issue the following command:
  26. .. code-block:: bash
  27. sudo yum install httpd
  28. Then start the web server
  29. .. code-block:: bash
  30. sudo systemctl start httpd.service
  31. Execute the following to ensure that the Apache server is started automatically if the server reboots:
  32. .. code-block:: bash
  33. sudo systemctl enable httpd.service
  34. Apache should now be installed. On the server, navigate to your new website using this address: http://localhost/. You should see the following page:
  35. .. image:: centos_7.apache1.png
  36. Next we need to edit the web site configuration file. The configuration file specific for the default website is found here: /etc/httpd/conf/httpd.conf. Drupal needs permission to override some default restrictions set by the Apache web server, but it only needs to do so in the directory where it will be installed. By default in CentOS 7, the web document root is the /var/www/html directory. This is where all web files will be placed. Therefore, we need to adjust the default settings for that directory for Drupal. To do so, edit this file using the 'gedit' graphical text editor (should be previously installed). Because this file is owned by the 'root' user, we must use the 'sudo' command to run 'gedit' with administrative privileges:
  37. .. code-block:: bash
  38. sudo gedit /etc/httpd/conf/httpd.conf
  39. Find the Directory stanza for the /var/www/html directory and edit it so that it looks like the following:
  40. .. code-block:: bash
  41. <Directory /var/www/html>
  42. Options Indexes FollowSymLinks MultiViews
  43. AllowOverride All
  44. Order allow,deny
  45. allow from all
  46. </Directory>
  47. Now restart your Apache again.
  48. .. code-block:: bash
  49. sudo systemctl restart httpd.service
  50. Setup PHP
  51. ---------
  52. Drupal uses PHP. In CentOS there are two different instances of PHP that will be installed: a version for apache and another for use on the command-line. To install PHP we can use 'yum' utility:
  53. .. code-block:: bash
  54. yum install php
  55. Next, we need a few additional extension modules for PHP that support connection to a PostgreSQL database server, the GD graphics library and a few others:
  56. .. code-block:: bash
  57. sudo yum install php-gd php-pgsql php-mbstring php-xml
  58. PHP is now installed. Before continuing we must make a few changes to the PHP configuration file. PHP will limit the amount of memory that a script can consume. By default this limit is too low the Apache configuration of PHP. For Tripal we need that limit to be higher. To change it, edit the /etc/php.ini configuration file:
  59. .. code-block:: bash
  60. sudo gedit /etc/php.ini
  61. Within that file, find the setting titled, memory_limit, and change it to something larger than 128M. For this tutorial we will set the limit to be 2048M, but be sure not to exceed physical memory of your machine:
  62. .. code-block:: php
  63. memory_limit = 2048M
  64. Now, restart the webserver so that it picks up the new changes to the PHP settings.
  65. .. code-block:: bash
  66. sudo systemctl restart httpd.service
  67. PostgreSQL Server
  68. -----------------
  69. PostgreSQL is the database software that will be used to house both the Drupal and Tripal databases. PostgreSQL can be installed on CentOS 7 simply by issuing the following command.
  70. .. code-block:: bash
  71. sudo yum install postgresql-server
  72. Next, initialize the PostgreSQL database:
  73. .. code-block:: bash
  74. sudo postgresql-setup initdb
  75. PostgreSQL database server is now installed and setup with default options. However, it currently does not allow connections. We want to allow at least connections from the local machine. To do this, edit the /var/lib/pgsql/data/pg_hba.conf file:
  76. .. code-block:: bash
  77. sudo gedit /var/lib/pgsql/data/pg_hba.conf
  78. And set the following to allow connections from the localhost:
  79. .. code-block:: bash
  80. # IPv4 local connections:
  81. host all all 127.0.0.1/32 md5
  82. # IPv6 local connections:
  83. host all all ::1/128 md5
  84. Be sure that any previous "host" lines are commented out by adding a '#' symbol in front. Next, start up the PostgreSQL server
  85. .. code-block:: bash
  86. systemctl start postgresql.service
  87. Finally execute the following to ensure that the PostgreSQL server is started automatically if the server reboots:
  88. .. code-block:: bash
  89. systemctl enable postgresql.service
  90. SE-Linux Configuration
  91. ----------------------
  92. SE-Linux is short for Security Enhanced Linux. It comes installed in RedHat flavors of Linux (such as CentOS). It provides access control mechanisms. If your operating system comes with SE-Linux you will want to change the security context for the web files and associate those with the web server. The following command can be executed to allow that:
  93. .. code-block:: bash
  94. sudo chcon -R -t httpd_sys_content_rw_t /var/www/html
  95. Additionally, we need to allow web scripts and modules to connect to database servers.
  96. .. code-block:: bash
  97. setsebool -P httpd_can_network_connect_db on
  98. Install phpPgAdmin (Optional)
  99. -----------------------------
  100. phpPgAdmin is a web-based utility for easy administration of a PostgreSQL database. PhpPgAdmin is not required for successful operation of Tripal but is very useful. First, we need to install the Extra Packages for Enterprise Linux (EPEL) library. This library contains many compatible packages including phpPgAdmin. This can be done with the following command:
  101. .. code-block:: bash
  102. rpm -Uvh http://mirror.pnl.gov/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  103. Next, phpPgAdmin can be easily installed with a 'yum' command:
  104. .. code-block:: bash
  105. sudo yum install phpPgAdmin
  106. Next, we need to configure phpPgAdmin. To do this, Edit the /etc/phpPgAdmin/config.inc.php file.
  107. .. code-block:: bash
  108. sudo gedit /etc/phpPgAdmin/config.inc.php
  109. Within this file, add "localhost" in the following server parameter:
  110. .. code-block:: bash
  111. $conf['servers'][0]['host'] = 'localhost';
  112. Now navigate to the URL http://localhost/phpPgAdmin and you should see the following:
  113. .. image:: centos_7.phppgadmin.png
  114. Now, phpPgAdmin is available for access only on the local installation of the machine. It will not be available via remote connections.