This article will describe installing Drupal which is a content management system.
Table of Contents
1 Install Drupal
- This article uses default SSL/TLS certicication file for https. Please change your SSL/TLS certification file.
- If you use http instead of https, change https to http in firewall-cmd's service argument.
- DRUPAL_PASSWD is password of drupal7 user in MySQL.
#!/bin/sh -e [ -z "${DRUPAL_PASSWD}" ] && \ DRUPAL_PASSWD=drupal_passwd drupal_install_mysql() { sudo dnf install -y mariadb-server php-mysqlnd sudo systemctl enable mariadb sudo systemctl start mariadb cat<<EOF | sudo mysql -u root create database drupal7 character set utf8 collate utf8_general_ci; grant all privileges on drupal7.* to drupal7@localhost identified by '${DRUPAL_PASSWD}'; exit EOF } drupal_install_drupal() { sudo dnf install -y drupal7 drush sudo cp /etc/drupal7/default/default.settings.php \ /etc/drupal7/default/settings.php echo "require_once('dbconfig.php');" | \ sudo tee -a /etc/drupal7/default/settings.php cat <<EOF | sudo tee /etc/drupal7/default/dbconfig.php <?php \$dbs['mysql'] = array( 'driver' => 'mysql', 'database' => 'drupal7', 'username' => 'drupal7', 'password' => '${DRUPAL_PASSWD}', 'host' => 'localhost', 'port' => '', 'prefix' => '' ); \$databases['default']['default'] = \$dbs['mysql']; ?> EOF } drupal_install_apache() { sudo dnf install -y mod_ssl sudo sed -e 's/Require local/Require all granted/g' \ -i /etc/httpd/conf.d/drupal7.conf sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd --reload sudo systemctl enable httpd sudo systemctl restart httpd } drupal_main() { drupal_install_mysql drupal_install_drupal drupal_install_apache } drupal_main