From Fedora Project Wiki

(Add SELinux note)
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{autolang|base=yes}}
{{admon/note | Installing in a cluster situation? | Check out our page on [[how to install Drupal in a cluster]].}}
{{admon/note | Installing in a cluster situation? | Check out our page on [[how to install Drupal in a cluster]].}}


Line 9: Line 10:


<li>Install necessary packages:
<li>Install necessary packages:
<pre>yum shell
<pre>dnf install @'Web Server' mariadb-server drupal7</pre></li>
> groupinstall 'Web Server' 'MySQL Database'
> install drupal
> run ts</pre></li>


<li>If you have not already done so, start the MySQL database server:
<li>If you have not already done so, start the MariaDB database server:
<pre>service mysqld start</pre></li>
<pre>systemctl start mariadb</pre></li>


<li>If you have not already done so, set up the MySQL database server's administrator account. First, provide a root password.
<li>If you have not already done so, set up the MySQL database server's administrator account. First press enter for the password and then provide a root password.
{{admon/warning | Do not use root account password | Do not provide the system administrator's password for your Linux system here. Use a different strong password, since this is a separate authentication for a MySQL user called "root."}}
{{admon/warning | Do not use root account password | Do not provide the system administrator's password for your Linux system here. Use a different strong password, since this is a separate authentication for a MySQL user called "root."}}
<pre>mysqladmin -u root password $PASSWORD</pre></li>
<pre>mysql_secure_installation</pre></li>


<li>Create a database for Drupal:
<li>Create a database for Drupal:
Line 29: Line 27:
<pre>[root@publictest1 ~]# mysql -u root -p
<pre>[root@publictest1 ~]# mysql -u root -p
Enter password:  
Enter password:  
Welcome to the MySQL monitor.  Commands end with ; or \g.
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Your MariaDB connection id is 11
Server version: 5.1.41 Source distribution
Server version: 10.0.20-MariaDB MariaDB Server
 
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Line 52: Line 52:
<li>Turn on the SELinux booleans that allow the Apache web server to contact the MySQL database via the network and send email:
<li>Turn on the SELinux booleans that allow the Apache web server to contact the MySQL database via the network and send email:
<pre>setsebool -P httpd_can_network_connect_db=1
<pre>setsebool -P httpd_can_network_connect_db=1
setsebool -P httpd_can_sendmail=1</pre></li>
setsebool -P httpd_can_sendmail=1</pre>
<li>Edit the {{filename|/etc/httpd/conf.d/drupal.conf}} file.  If you are installing on the same system where you run your Web browser, uncomment the line below:
{{admon/note | Drupal on RHEL 6 | If you happen to be using RHEL 6 or a compatible OS, you may need the following changes to adapt SELinux policy for Drupal:
<pre>Allow from 127.0.0.1</pre>
 
<ol><li> Install the ''policycoreutils-python'' package which contains the ''/usr/sbin/semanage'' tool.</li>
<li>Run the following commands:
<pre>semanage fcontext -a -t httpd_sys_rw_content_t "/etc/drupal(7)?(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/var/lib/drupal(7)?(/.*)?"
semanage fcontext -a -t httpd_sys_content_t "/usr/share/drupal(7)?(/.*)?"
restorecon -rv /usr/share/drupal7 /etc/drupal7 /var/lib/drupal7</pre></li></ol>
}}
</li>
<li>Edit the {{filename|/etc/httpd/conf.d/drupal7.conf}} file.  If you are installing on the same system where you run your Web browser, keep the default values below:
<pre>Require local</pre>
If you are installing on a different system on your network, change the previous lines so they read as follows:
If you are installing on a different system on your network, change the previous lines so they read as follows:
<pre>#Deny from All
<pre>Require all granted</pre>
Allow from All</pre>
Save the file.</li>
Save the file.</li>


<li>Edit the {{filename|/usr/share/drupal/.htaccess}} file.  Uncomment the line below:
<li>Edit the {{filename|/usr/share/drupal7/.htaccess}} file.  Uncomment the line below:
<pre>RewriteBase /drupal</pre>
<pre>RewriteBase /drupal</pre>
Save the file.</li>
Save the file.</li>
Line 67: Line 76:


<li>Copy and change the permissions on the default settings file:
<li>Copy and change the permissions on the default settings file:
<pre>cp /etc/drupal/default/default.settings.php /etc/drupal/default/settings.php
<pre>cp /etc/drupal7/default/default.settings.php /etc/drupal7/default/settings.php
chmod 666 /etc/drupal/default/settings.php</pre></li>
chmod 666 /etc/drupal7/default/settings.php</pre></li>


<li>Edit the {{filename|/etc/php.ini}} file to set the <code>date.timezone</code> for PHP on the system.  Uncomment the line and insert your timezone, for example:
<li>Edit the {{filename|/etc/php.ini}} file to set the <code>date.timezone</code> for PHP on the system.  Uncomment the line and insert your timezone, for example:
Line 75: Line 84:


<li>Start the Apache web server:
<li>Start the Apache web server:
<pre>service httpd start</pre></li>
<pre>systemctl start httpd</pre></li>


<li>Point your web browser at the system to be installed and follow the instructions on screen.  When prompted for database information, remember to use the information for the ''drupal'' MySQL database you installed earlier.  When the site asks for Drupal administrator account information later, you should use a different user name and passphrase.</li>
<li>Point your web browser at the system to be installed and follow the instructions on screen.  When prompted for database information, remember to use the information for the ''drupal'' MySQL database you installed earlier.  When the site asks for Drupal administrator account information later, you should use a different user name and passphrase.</li>


<li>Remove write permissions from the settings file:
<li>Remove write permissions from the settings file:
<pre>chmod 644 /etc/drupal/default/settings.php</pre></li>
<pre>chmod 644 /etc/drupal7/default/settings.php</pre></li>


</ol>
</ol>

Latest revision as of 13:27, 29 October 2015

Installing in a cluster situation?
Check out our page on how to install Drupal in a cluster.

This page explains how to install Drupal on Fedora systems. The /usr/share/doc/drupal-*/drupal-README.fedora page on your system also has up-to-date instructions for your versions of Fedora and Drupal.

Web and SQL server setup

  1. Switch to the root account. Enter the root password at the prompt.
    su -
  2. Install necessary packages:
    dnf install @'Web Server' mariadb-server drupal7
  3. If you have not already done so, start the MariaDB database server:
    systemctl start mariadb
  4. If you have not already done so, set up the MySQL database server's administrator account. First press enter for the password and then provide a root password.
    Do not use root account password
    Do not provide the system administrator's password for your Linux system here. Use a different strong password, since this is a separate authentication for a MySQL user called "root."
    mysql_secure_installation
  5. Create a database for Drupal:
    mysqladmin -u root -p create drupal
    Database creation
    You will be prompted to enter the MySQL "root" password from the previous step.
  6. Grant rights for a Drupal administrator on this database:
    [root@publictest1 ~]# mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 11
    Server version: 10.0.20-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> GRANT ALL PRIVILEGES ON drupal.* TO drupaladmin@localhost IDENTIFIED BY 'DRUPAL_PASSWORD';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> QUIT;
    Bye
    The drupaladmin account and the DRUPAL_PASSWORD you used above are the ones you will use in Drupal's installation process shortly.

Drupal setup

  1. Turn on the SELinux booleans that allow the Apache web server to contact the MySQL database via the network and send email:
    setsebool -P httpd_can_network_connect_db=1
    setsebool -P httpd_can_sendmail=1
    Drupal on RHEL 6
    If you happen to be using RHEL 6 or a compatible OS, you may need the following changes to adapt SELinux policy for Drupal:
    1. Install the policycoreutils-python package which contains the /usr/sbin/semanage tool.
    2. Run the following commands:
      semanage fcontext -a -t httpd_sys_rw_content_t "/etc/drupal(7)?(/.*)?"
      semanage fcontext -a -t httpd_sys_rw_content_t "/var/lib/drupal(7)?(/.*)?"
      semanage fcontext -a -t httpd_sys_content_t "/usr/share/drupal(7)?(/.*)?"
      restorecon -rv /usr/share/drupal7 /etc/drupal7 /var/lib/drupal7
  2. Edit the /etc/httpd/conf.d/drupal7.conf file. If you are installing on the same system where you run your Web browser, keep the default values below:
    Require local

    If you are installing on a different system on your network, change the previous lines so they read as follows:

    Require all granted
    Save the file.
  3. Edit the /usr/share/drupal7/.htaccess file. Uncomment the line below:
    RewriteBase /drupal
    Save the file.
  4. If necessary, change your firewall settings to permit TCP port 80 (HTTP) traffic.
  5. Copy and change the permissions on the default settings file:
    cp /etc/drupal7/default/default.settings.php /etc/drupal7/default/settings.php
    chmod 666 /etc/drupal7/default/settings.php
  6. Edit the /etc/php.ini file to set the date.timezone for PHP on the system. Uncomment the line and insert your timezone, for example:
    date.timezone = America/New_York
    If you are unsure what to put here, look in the Drupal system's /usr/share/zoneinfo directory. You can use the relative name of a file in that directory for the timezone setting here.
  7. Start the Apache web server:
    systemctl start httpd
  8. Point your web browser at the system to be installed and follow the instructions on screen. When prompted for database information, remember to use the information for the drupal MySQL database you installed earlier. When the site asks for Drupal administrator account information later, you should use a different user name and passphrase.
  9. Remove write permissions from the settings file:
    chmod 644 /etc/drupal7/default/settings.php