KaliLinux 2018.2: Install WordPress for CMS


Table of Contents

1 Install WordPress

  • Change WORDPRESS_DOMAIN to your machine’s FQDN.
  • 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 443 to 80 and delete SSLXXX directive in /etc/apache2/sites-available/wordpress.conf.

#!/bin/sh -e[ -z “${WORDPRESS_DOMAIN}” ] && WORDPRESS_DOMAIN=$(hostname -f)[ -z “${WORDPRESS_SITENAME}” ] && WORDPRESS_SITENAME=wordpressMYSQL_VERSION=5.7[ -z “${MYSQL_PASSWD}” ] && MYSQL_PASSWD=mysqlmysql_install(){ sudo apt install -y default-mysql-server sudo systemctl enable mysql sudo systemctl restart mysql cat <<EOF | sudo mysql_secure_installationy${MYSQL_PASSWD}${MYSQL_PASSWD}nyyyEOF}wordpress_install(){ sudo apt install -y wordpress # Change filesystem access method from FTP to direct. # This will change plugin installation via FTP to plugin installation # with direct filesystem access. sudo sed -e “s/^<?php/<?phpndefine(‘FS_METHOD’, ‘direct’);/g” -i /usr/share/wordpress/wp-config.php TMP=$(mktemp -t wordpress.sh.XXXXXX) trap ‘rm $TMP* 2>/dev/null’ 0 zcat /usr/share/doc/wordpress/examples/setup-mysql.gz > “${TMP}” # You can select remote mysql server with -t option. # You can set mysql database username with -u option. sudo bash “${TMP}” -n “${WORDPRESS_SITENAME}” “${WORDPRESS_DOMAIN}”}apache_install(){ sudo apt install -y apache2 cat <<EOF | sudo tee /etc/apache2/sites-available/wordpress.conf<VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key ServerName ${WORDPRESS_DOMAIN} DocumentRoot /usr/share/wordpress/ DirectoryIndex index.php index.html ErrorLog /var/log/apache2/wp-error.log TransferLog /var/log/apache2/wp-access.log Alias /wp-content /var/lib/wordpress/wp-content <Directory /usr/share/wordpress> Options FollowSymLinks Require all granted </Directory> <Directory /var/lib/wordpress/wp-content> Options FollowSymLinks Require all granted </Directory></VirtualHost>EOF sudo a2enmod ssl sudo a2ensite wordpress sudo systemctl enable apache2 sudo systemctl restart apache2}wordpress_main(){ mysql_install wordpress_install apache_install}wordpress_main

2 Access to WordPress

Access to your FQDN via https. Accept this page’s certification to browser.

https://<WORDPRESS_DOMAIN>

0001_WordPress.png

Android | Linux | SDL - Narrow Escape