ArchLinux 2017.10.01: Install Drupal for CMS

Table of Contents

1 Install Drupal

The following script will install Drupal.

  • MYSQL_PASSWD is root user password of MySQL.

#!/bin/shset -e[ -z “${MYSQL_PASSWD}” ] && MYSQL_PASSWD=mysqlpostfix_install(){ sudo pacman -Sy –noconfirm postfix sudo systemctl enable postfix cat <<EOF | sudo tee /etc/postfix/main.cfmyhostname = localhostmydomain = localdomainmyorigin = $myhostname.$mydomainmydestination = localhost, localhost.$mydomain, $myhostname, $mydomain, $myorigincompatibility_level = 2command_directory = /usr/bindaemon_directory = /usr/lib/postfix/bindata_directory = /var/lib/postfixmail_owner = postfixinet_interfaces = alllocal_recipient_maps = unix:passwd.byname $alias_mapsunknown_local_recipient_reject_code = 550mynetworks_style = subnetmynetworks = = hash:/etc/postfix/aliasesalias_database = $alias_mapsdebugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5sendmail_path = /usr/bin/sendmailnewaliases_path = /usr/bin/newaliasesmailq_path = /usr/bin/mailqsetgid_group = postdropinet_protocols = ipv4EOF sudo newaliases sudo systemctl restart postfix}mysql_install(){ sudo pacman -Sy –noconfirm mariadb # Install database. sudo mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql sudo systemctl enable mariadb sudo systemctl start mariadb # Password configuration. cat <<EOF | sudo mysql_secure_installationy${MYSQL_PASSWD}${MYSQL_PASSWD}nyyyEOF}php_install(){ # Enable PHP extension. sudo pacman -Sy –noconfirm php sudo sed -i /etc/php/php.ini -e ‘s/^;’ -e ‘s/^;’ -e ‘s/^;’ -e ‘s/^;’ -e ‘s/^;opcache.enable=1/opcache.enable=1/g’}drupal_install(){ sudo pacman -Sy –noconfirm drupal sudo sed -i /usr/share/webapps/drupal/.htaccess -e ‘s/Require all denied/Require all granted/g’}apache_install(){ sudo pacman -Sy –noconfirm apache php-apache sudo systemctl enable httpd # PHP configuration. sudo sed -i /etc/httpd/conf/httpd.conf -e ‘s/^LoadModule mpm_event_module/#LoadModule mpm_event_module/g’ -e ‘s/^#LoadModule mpm_prefork_module/LoadModule mpm_prefork_module/g’ cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.confLoadModule php7_module modules/libphp7.soAddHandler php7-script phpInclude conf/extra/php7_module.confEOF # ssl configuration. # Country Name (2 letter code) [AU]: # State or Province Name (full name) [Some-State]: # Locality Name (eg, city) []: # Organization Name (eg, company) [Internet Widgits Pty Ltd]: # Organizational Unit Name (eg, section) []: # Common Name (e.g. server FQDN or YOUR name) []: # Email Address []: cat <<EOF | sudo openssl req -new -x509 -nodes -newkey rsa:4096 -days 1095 -keyout /etc/httpd/conf/server.key -out /etc/httpd/conf/server.crtAUSome-Statecitycompanysection${WEBDAV_SERVER_FQDN}EOF sudo sed -i /etc/httpd/conf/httpd.conf -e ‘s/^#LoadModule ssl_module/LoadModule ssl_module/g’ -e ‘s/^#LoadModule socache_shmcb_module/LoadModule socache_shmcb_module/g’ cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.confInclude conf/extra/httpd-ssl.confEOF # rewrite configuration. sudo sed -i /etc/httpd/conf/httpd.conf -e ‘s/^#LoadModule rewrite_module/LoadModule rewrite_module/g’ cat << EOF | sudo tee /etc/httpd/conf/extra/redirect-to-https.confRewriteEngine OnRewriteCond %{HTTPS} offRewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}EOF cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.confInclude conf/extra/redirect-to-https.confEOF # drupal configuration. sudo cp /etc/webapps/drupal/apache.example.conf /etc/httpd/conf/extra/drupal.conf cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.confInclude conf/extra/drupal.confEOF sudo systemctl restart httpd}drupal_main(){ postfix_install mysql_install php_install drupal_install apache_install}drupal_main

2 Access to Drupal

Access to the following URL and setup Drupal. Accept this page’s certification to browser.



Android | Linux | SDL - Narrow Escape